2 Star 5 Fork 4

航耍耍/mql4

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Amazing3.1-去限制去垃圾代码_源码.mq4 166.79 KB
一键复制 编辑 原始数据 按行查看 历史
航耍耍 提交于 2021-11-09 08:24 . 123123123123
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862
//EA交易 => ...\MT4\MQL4\Experts
#property copyright "Amazing3.1"
#property version "3.1"
#property strict
//enum ENUM_TIMEFRAMES {PERIOD_CURRENT = 0, PERIOD_M1 = 1, PERIOD_M2 = 2, PERIOD_M3 = 3, PERIOD_M4 = 4, PERIOD_M5 = 5, PERIOD_M6 = 6, PERIOD_M10 = 10, PERIOD_M12 = 12, PERIOD_M15 = 15, PERIOD_M20 = 20, PERIOD_M30 = 30, PERIOD_H1 = 60, PERIOD_H2 = 120, PERIOD_H3 = 180, PERIOD_H4 = 240, PERIOD_H6 = 360, PERIOD_H8 = 480, PERIOD_H12 = 720, PERIOD_D1 = 1440, PERIOD_W1 = 10080, PERIOD_MN1 = 43200, };
enum opentime {
A = 1,//开单时区模式
B = 2,//开单时间间距(秒)模式
C = 3,//不延迟模式
};
//------------------
extern double On_top_of_this_price_not_Buy_first_order=0 ; //B以上不开(首)
extern double On_under_of_this_price_not_Sell_first_order=0 ; //S以下不开(首)
extern double On_top_of_this_price_not_Buy_order=0 ; //B以上不开(补)
extern double On_under_of_this_price_not_Sell_order=0 ; //S以下不开(补)
extern string Limit_StartTime="00:00" ; //限价开始时间
extern string Limit_StopTime="24:00" ; //限价结束时间
extern bool CloseBuySell=true ; //逆势保护开关
extern bool HomeopathyCloseAll=true ; //顺势保护开关
extern bool Homeopathy=false ; //完全对锁时挂上顺势开关
extern bool Over=false ; //平仓后停止交易
extern int NextTime=0 ; //整体平仓后多少秒后新局
extern double Money=0 ; //浮亏多少启用第二参数
extern int FirstStep=30 ; //首单距离
extern int MinDistance=60 ; //最小距离
extern int TwoMinDistance=60 ; //第二最小距离
extern int StepTrallOrders=5 ; //挂单追踪点数
extern int Step=100 ; //补单间距
extern int TwoStep=100 ; //第二补单间距
extern opentime OpenMode=3 ;
extern ENUM_TIMEFRAMES TimeZone=1 ; //开单时区
extern int sleep=30 ; //开单时间间距(秒)
extern double MaxLoss=100000 ; //单边浮亏超过多少不继续加仓
extern double MaxLossCloseAll=50 ; //单边平仓限制
extern double lot=0.01 ; //起始手数
extern double Maxlot=10 ; //最大开单手数
extern double PlusLot=0 ; //累加手数
extern double K_Lot=1.3 ; //倍率
extern int DigitsLot=2 ; //下单量的小数位
extern double CloseAll=0.5 ; //整体平仓金额
extern bool Profit=true ; //单边平仓金额累加开关
extern double StopProfit=2 ; //单边平仓金额
extern double StopLoss=0 ; //总亏损全平金额
extern int Magic=9453 ;
extern int Totals=50 ; //最大单量
extern int MaxSpread=32 ; //点差限制
extern int Leverage=100 ; //平台杠杆限制
extern string EA_StartTime="00:00" ; //EA开始时间
extern string EA_StopTime="24:00" ; //EA结束时间
bool 总_bo_1 = true;
bool 总_bo_2 = true;
int 总_in_3 = 1;
int 总_in_4 = 0;
int 总_in_5 = 10;
uint 总_ui_6 = Lime;
uint 总_ui_7 = Blue;
uint 总_ui_8 = Red;
datetime 总_da_9 = 0;
bool 总_bo_10 = true;
bool 总_bo_11 = false;
bool 总_bo_12 = false;
string 总_st_13 = "";
string 总_st_14 = "0-off 1-Candle 2-Fractals >2-pips";
int 总_in_15 = 3;
int 总_in_16 = 20;
int 总_in_17 = 25;
int 总_in_18 = 0;
int 总_in_19 = 15;
int 总_in_20 = 0;
int 总_in_21 = 346856;
int 总_in_22 = 0;
double 总_do_23 = 0.0;
double 总_do_24 = 0.0;
int 总_in_25 = 1482134400;
string 总_st_26 = "Exness Ltd.";
string 总_st_27 = "CB Financial Services Limited";
int 总_in_28 = 1;
int 总_in_29 = 2;
double 总_do_30 = 10.0;
uint 总_ui_31 = DimGray;
string 总_st_32 = "Spread";
int 总_in_33 = 0;
bool 总_bo_34 = true;
string 总_st_35 = "Button1";
string 总_st_36 = "Button2";
string 总_st_37 = "Button5";
int 总_in_38 = 55295;
int 总_in_39 = 16777215;
int 总_in_40 = 65280;
int 总_in_41 = 65280;
int 总_in_42 = 65535;
int 总_in_43 = 12632256;
string 总_st_44 = "Lever";
string 总_st_45 = "Spreads";
int 总_in_46 = 0;
int 总_in_47 = 25;
int 总_in_48 = 180;
bool 总_bo_49 = false;
string 总_st_50 = "Amazing3.1";
double 总_do_51 = 0.0;
double 总_do_52 = 0.0;
int 总_in_53 = 0;
int 总_in_54 = 0;
int 总_in_55 = 0;
string 总_st_56 = "000,000,000";
string 总_st_57 = "000,000,255";
int 总_in_58 = 40;
int 总_in_59 = 0;
int 总_in_60 = 0;
int 总_in_61 = 0;
datetime 总_da_62 = 0;
datetime 总_da_63 = 0;
datetime 总_da_64 = 0;
datetime 总_da_65 = 0;
datetime 总_da_66 = 0;
datetime 总_da_67 = 0;
datetime 总_da_68 = 0;
int 总_in_69 = 0;
int init ()
{
int 子_in_1;
bool 子_bo_2;
string 子_st_3;
int 子_in_4;
//----------------------------
总_st_50 = WindowExpertName() ;
子_in_1 = 0 ;
子_bo_2 = false ;
子_in_4 = 0 ;
总_in_19 = lizong_8(总_in_19) ;
if ( ( Digits() == 5 || Digits() == 3 ) )
{
总_in_22 = 30 ;
}
Comment("");
总_in_20=MathMax(MarketInfo(Symbol(),33),MarketInfo(Symbol(),14)) + 1;
if ( Step < 总_in_20 )
{
Step = 总_in_20 ;
}
if ( FirstStep < 总_in_20 )
{
FirstStep = 总_in_20 ;
}
if ( MinDistance < 总_in_20 )
{
MinDistance = 总_in_20 ;
}
if ( 总_bo_34 )
{
ObjectCreate(0,总_st_35,OBJ_BUTTON,0,0,0.0);
ObjectSetInteger(0,总_st_35,OBJPROP_CORNER,2);
ObjectSetInteger(0,总_st_35,OBJPROP_COLOR,16777215);
ObjectSetInteger(0,总_st_35,OBJPROP_BGCOLOR,6908265);
ObjectSetInteger(0,总_st_35,OBJPROP_BORDER_COLOR,16777215);
ObjectSetInteger(0,总_st_35,OBJPROP_XDISTANCE,0);
ObjectSetInteger(0,总_st_35,OBJPROP_YDISTANCE,30);
ObjectSetInteger(0,总_st_35,OBJPROP_XSIZE,55);
ObjectSetInteger(0,总_st_35,OBJPROP_YSIZE,30);
ObjectSetString(0,总_st_35,OBJPROP_FONT,"黑体");
ObjectSetString(0,总_st_35,OBJPROP_TEXT,"C buy");
ObjectSetInteger(0,总_st_35,OBJPROP_FONTSIZE,15);
ObjectSetInteger(0,总_st_35,OBJPROP_SELECTABLE,1);
ObjectSetInteger(0,总_st_35,OBJPROP_SELECTED,0);
ObjectCreate(0,总_st_36,OBJ_BUTTON,0,0,0.0);
ObjectSetInteger(0,总_st_36,OBJPROP_CORNER,2);
ObjectSetInteger(0,总_st_36,OBJPROP_COLOR,16777215);
ObjectSetInteger(0,总_st_36,OBJPROP_BGCOLOR,6908265);
ObjectSetInteger(0,总_st_36,OBJPROP_BORDER_COLOR,16777215);
ObjectSetInteger(0,总_st_36,OBJPROP_XDISTANCE,60);
ObjectSetInteger(0,总_st_36,OBJPROP_YDISTANCE,30);
ObjectSetInteger(0,总_st_36,OBJPROP_XSIZE,55);
ObjectSetInteger(0,总_st_36,OBJPROP_YSIZE,30);
ObjectSetString(0,总_st_36,OBJPROP_FONT,"黑体");
ObjectSetString(0,总_st_36,OBJPROP_TEXT,"C sel");
ObjectSetInteger(0,总_st_36,OBJPROP_FONTSIZE,15);
ObjectSetInteger(0,总_st_36,OBJPROP_SELECTABLE,1);
ObjectSetInteger(0,总_st_36,OBJPROP_SELECTED,0);
ObjectCreate(0,总_st_37,OBJ_BUTTON,0,0,0.0);
ObjectSetInteger(0,总_st_37,OBJPROP_CORNER,2);
ObjectSetInteger(0,总_st_37,OBJPROP_COLOR,16777215);
ObjectSetInteger(0,总_st_37,OBJPROP_BGCOLOR,6908265);
ObjectSetInteger(0,总_st_37,OBJPROP_BORDER_COLOR,16777215);
ObjectSetInteger(0,总_st_37,OBJPROP_XDISTANCE,30);
ObjectSetInteger(0,总_st_37,OBJPROP_YDISTANCE,70);
ObjectSetInteger(0,总_st_37,OBJPROP_XSIZE,55);
ObjectSetInteger(0,总_st_37,OBJPROP_YSIZE,30);
ObjectSetString(0,总_st_37,OBJPROP_FONT,"黑体");
ObjectSetString(0,总_st_37,OBJPROP_TEXT,"Close");
ObjectSetInteger(0,总_st_37,OBJPROP_FONTSIZE,15);
ObjectSetInteger(0,总_st_37,OBJPROP_SELECTABLE,1);
ObjectSetInteger(0,总_st_37,OBJPROP_SELECTED,0);
}
子_in_1 = 总_in_5 + 总_in_5 / 2;
ObjectCreate("Balance",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Balance",OBJPROP_CORNER,1.0);
ObjectSet("Balance",OBJPROP_XDISTANCE,5.0);
ObjectSet("Balance",OBJPROP_YDISTANCE,子_in_1);
子_in_1 = 子_in_1 + 总_in_5 * 2;
ObjectCreate("Equity",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Equity",OBJPROP_CORNER,1.0);
ObjectSet("Equity",OBJPROP_XDISTANCE,5.0);
ObjectSet("Equity",OBJPROP_YDISTANCE,子_in_1);
子_in_1 = 子_in_1 + 总_in_5 * 2;
ObjectCreate("FreeMargin",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("FreeMargin",OBJPROP_CORNER,1.0);
ObjectSet("FreeMargin",OBJPROP_XDISTANCE,5.0);
ObjectSet("FreeMargin",OBJPROP_YDISTANCE,子_in_1);
子_in_1 = 子_in_1 + 总_in_5 * 2;
ObjectCreate("ProfitB",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("ProfitB",OBJPROP_CORNER,1.0);
ObjectSet("ProfitB",OBJPROP_XDISTANCE,5.0);
ObjectSet("ProfitB",OBJPROP_YDISTANCE,子_in_1);
子_in_1 = 子_in_1 + 总_in_5 * 2;
ObjectCreate("ProfitS",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("ProfitS",OBJPROP_CORNER,1.0);
ObjectSet("ProfitS",OBJPROP_XDISTANCE,5.0);
ObjectSet("ProfitS",OBJPROP_YDISTANCE,子_in_1);
子_in_1 = 子_in_1 + 总_in_5 * 2;
ObjectCreate("Profit",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Profit",OBJPROP_CORNER,1.0);
ObjectSet("Profit",OBJPROP_XDISTANCE,5.0);
ObjectSet("Profit",OBJPROP_YDISTANCE,子_in_1);
子_in_1 = 子_in_1 + 总_in_5 * 3;
子_bo_2 = false ;
子_st_3 = "Paramfalse" ;
MaxLossCloseAll = -(MaxLossCloseAll);
MaxLoss = -(MaxLoss);
StopLoss = -(StopLoss);
Money = -(Money);
if ( 总_st_50 != WindowExpertName() )
{
Comment("");
总_bo_1 = false ;
总_bo_2 = false ;
ObjectsDeleteAll(-1,-1);
if ( ObjectFind(总_st_32) < 0 )
{
ObjectCreate(总_st_32,OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet(总_st_32,OBJPROP_CORNER,1.0);
ObjectSet(总_st_32,OBJPROP_YDISTANCE,260.0);
ObjectSet(总_st_32,OBJPROP_XDISTANCE,10.0);
ObjectSetText(总_st_32,"Spread: " + DoubleToString((Ask - Bid) / 总_do_30,1) + " pips",13,"Arial",总_ui_31);
}
ObjectSetText(总_st_32,"Spread: " + DoubleToString((Ask - Bid) / 总_do_30,1) + " pips",0,NULL,0xFFFFFFFF);
WindowRedraw();
WindowRedraw();
}
PlaySound("Starting.wav");
StringReplace(EA_StartTime," ","");
StringReplace(EA_StopTime," ","");
StringTrimLeft(EA_StartTime);
StringTrimLeft(EA_StopTime);
StringTrimRight(EA_StartTime);
StringTrimRight(EA_StopTime);
if ( EA_StopTime == "24:00" )
{
EA_StopTime = "23:59:59" ;
}
StringReplace(Limit_StartTime," ","");
StringReplace(Limit_StopTime," ","");
StringTrimLeft(Limit_StartTime);
StringTrimLeft(Limit_StopTime);
StringTrimRight(Limit_StartTime);
StringTrimRight(Limit_StopTime);
if ( Limit_StopTime == "24:00" )
{
Limit_StopTime = "23:59:59" ;
}
return(0);
}
//init
//--------------------- ----------------------------------------
int start ()
{
bool 子_bo_1;
double 子_do_2;
double 子_do_3;
double 子_do_4;
double 子_do_5;
double 子_do_6;
double 子_do_7;
int 子_in_8;
int 子_in_9;
int 子_in_10;
int 子_in_11;
int 子_in_12;
int 子_in_13;
int 子_in_14;
double 子_do_15;
double 子_do_16;
double 子_do_17;
double 子_do_18;
double 子_do_19;
double 子_do_20;
double 子_do_21;
double 子_do_22;
double 子_do_23;
double 子_do_24;
double 子_do_25;
double 子_do_26;
int 子_in_27;
double 子_do_28;
string 子_st_29;
double 子_do_30;
string 子_st_31;
double 子_do_32;
double 子_do_33;
bool 子_bo_34;
double 子_do_35;
double 子_do_36;
double 子_do_37;
double 子_do_38;
double 子_do_39;
//----------------------------
datetime 临_da_1;
bool 临_bo_2;
string 临_st_3;
string 临_st_4;
string 临_st_5;
string 临_st_6;
datetime 临_da_7;
bool 临_bo_8;
string 临_st_9;
string 临_st_10;
string 临_st_11;
string 临_st_12;
datetime 临_da_13;
bool 临_bo_14;
string 临_st_15;
string 临_st_16;
string 临_st_17;
string 临_st_18;
int 临_in_19;
double 临_do_20;
int 临_in_21;
double 临_do_22;
int 临_in_23;
string 临_st_24;
string 临_st_25;
int 临_in_26;
double 临_do_27;
int 临_in_28;
double 临_do_29;
string 临_st_30;
string 临_st_31;
int 临_in_32;
double 临_do_33;
int 临_in_34;
double 临_do_35;
int 临_in_36;
string 临_st_37;
string 临_st_38;
int 临_in_39;
double 临_do_40;
int 临_in_41;
double 临_do_42;
string 临_st_43;
int 临_in_44;
int 临_in_45;
string 临_st_46;
int 临_in_47;
int 临_in_48;
string 临_st_49;
int 临_in_50;
int 临_in_51;
string 临_st_52;
int 临_in_53;
int 临_in_54;
string 临_st_55;
string 临_st_56;
int 临_in_57;
double 临_do_58;
int 临_in_59;
double 临_do_60;
int 临_in_61;
string 临_st_62;
string 临_st_63;
int 临_in_64;
double 临_do_65;
int 临_in_66;
double 临_do_67;
string 临_st_68;
string 临_st_69;
int 临_in_70;
double 临_do_71;
int 临_in_72;
double 临_do_73;
int 临_in_74;
string 临_st_75;
string 临_st_76;
int 临_in_77;
double 临_do_78;
int 临_in_79;
double 临_do_80;
string 临_st_81;
string 临_st_82;
int 临_in_83;
double 临_do_84;
int 临_in_85;
double 临_do_86;
int 临_in_87;
string 临_st_88;
string 临_st_89;
int 临_in_90;
double 临_do_91;
int 临_in_92;
double 临_do_93;
string 临_st_94;
string 临_st_95;
int 临_in_96;
double 临_do_97;
int 临_in_98;
double 临_do_99;
int 临_in_100;
string 临_st_101;
string 临_st_102;
int 临_in_103;
double 临_do_104;
int 临_in_105;
double 临_do_106;
int 临_in_107;
int 临_in_108;
int 临_in_109;
double 临_do_110;
double 临_do_111;
int 临_in_112;
int 临_in_113;
int 临_in_114;
int 临_in_115;
double 临_do_116;
double 临_do_117;
int 临_in_118;
datetime 临_da_119;
bool 临_bo_120;
datetime 临_da_121;
bool 临_bo_122;
datetime 临_da_123;
bool 临_bo_124;
datetime 临_da_125;
bool 临_bo_126;
datetime 临_da_127;
bool 临_bo_128;
datetime 临_da_129;
bool 临_bo_130;
int 临_in_131;
int 临_in_132;
int 临_in_133;
int 临_in_134;
int 临_in_135;
datetime 临_da_136;
bool 临_bo_137;
datetime 临_da_138;
bool 临_bo_139;
datetime 临_da_140;
bool 临_bo_141;
datetime 临_da_142;
bool 临_bo_143;
datetime 临_da_144;
bool 临_bo_145;
datetime 临_da_146;
bool 临_bo_147;
int 临_in_148;
int 临_in_149;
int 临_in_150;
int 临_in_151;
int 临_in_152;
int 临_in_153;
int 临_in_154;
int 临_in_155;
switch(AccountNumber())
{
case 5320061 :
子_bo_1 = true ;
break;
case 200007738 :
子_bo_1 = true ;
break;
case 10048166 :
子_bo_1 = false ;
break;
case 7061521 :
子_bo_1 = false ;
break;
case 12456 :
子_bo_1 = false ;
break;
default :
子_bo_1 = false ;
}
if ( IsDemo() )
{
子_bo_1 = true ;
}
if ( IsTesting() )
{
子_bo_1 = true ;
}
/* if (1>2 && !(子_bo_1) )
{
Alert("非法帳戶" + string(AccountNumber()) + "\n" + "请与 QQ 3372807677 联络!");
总_bo_1 = false ;
总_bo_2 = false ;
ObjectsDeleteAll(-1,-1);
ExpertRemove();
WindowRedraw();
return(0);
}
*/
临_da_1 = 0;
if ( IsTesting() )
{
临_da_1 = TimeCurrent();
}
else
{
临_da_1 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_1),".",TimeMonth(临_da_1),".",TimeDay(临_da_1)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_1),".",TimeMonth(临_da_1),".",TimeDay(临_da_1)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_1 < 总_da_63 || 临_da_1 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_2 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_1 < 总_da_65 && 临_da_1 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_2 = false;
}
else
{
临_bo_2 = true;
}}
if ( 临_bo_2 )
{
if ( On_top_of_this_price_not_Buy_first_order!=0.0 )
{
ObjectCreate(0,"HLINE_LONG",OBJ_HLINE,0,0,On_top_of_this_price_not_Buy_first_order);
ObjectSet("HLINE_LONG",OBJPROP_STYLE,0.0);
ObjectSet("HLINE_LONG",OBJPROP_COLOR,10025880.0);
}
if ( On_under_of_this_price_not_Sell_first_order!=0.0 )
{
ObjectCreate(0,"HLINE_SHORT",OBJ_HLINE,0,0,On_under_of_this_price_not_Sell_first_order);
ObjectSet("HLINE_SHORT",OBJPROP_STYLE,0.0);
ObjectSet("HLINE_SHORT",OBJPROP_COLOR,16711935.0);
}
if ( On_top_of_this_price_not_Buy_order!=0.0 )
{
ObjectCreate(0,"HLINE_LONGII",OBJ_HLINE,0,0,On_top_of_this_price_not_Buy_order);
ObjectSet("HLINE_LONGII",OBJPROP_STYLE,2.0);
ObjectSet("HLINE_LONGII",OBJPROP_COLOR,10025880.0);
}
if ( On_under_of_this_price_not_Sell_order!=0.0 )
{
ObjectCreate(0,"HLINE_SHORTII",OBJ_HLINE,0,0,On_under_of_this_price_not_Sell_order);
ObjectSet("HLINE_SHORTII",OBJPROP_STYLE,2.0);
ObjectSet("HLINE_SHORTII",OBJPROP_COLOR,16711935.0);
}}
子_do_2 = 0.0 ;
子_do_3 = 0.0 ;
子_do_4 = 0.0 ;
子_do_5 = 0.0 ;
子_do_6 = 0.0 ;
子_do_7 = 0.0 ;
子_in_8 = 0 ;
子_in_9 = 0 ;
子_in_10 = 0 ;
子_in_11 = 0 ;
子_in_12 = 0 ;
子_in_13 = 0 ;
子_in_14 = 0 ;
子_do_15 = 0.0 ;
子_do_16 = 0.0 ;
子_do_17 = 0.0 ;
子_do_18 = 0.0 ;
子_do_19 = 0.0 ;
子_do_20 = 0.0 ;
子_do_21 = 0.0 ;
子_do_22 = 0.0 ;
子_do_23 = 0.0 ;
子_do_24 = 0.0 ;
子_do_25 = 0.0 ;
子_do_26 = 0.0 ;
子_in_27 = 0 ;
子_do_28 = 0.0 ;
子_do_30 = 0.0 ;
子_do_32 = 0.0 ;
子_do_33 = 0.0 ;
子_bo_34 = false ;
for (子_in_27 = 0 ; 子_in_27 < OrdersTotal() ; 子_in_27 = 子_in_27 + 1)
{
if ( !(OrderSelect(子_in_27,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || Magic != OrderMagicNumber() ) continue;
子_in_12 = OrderType() ;
子_do_7 = OrderLots() ;
子_do_2 = NormalizeDouble(OrderOpenPrice(),Digits()) ;
if ( 子_in_12 == 4 )
{
子_in_10 = 子_in_10 + 1;
if ( ( 子_do_15<子_do_2 || 子_do_15==0.0 ) )
{
子_do_15 = 子_do_2 ;
}
子_in_13 = OrderTicket() ;
子_do_19 = 子_do_2 ;
}
if ( 子_in_12 == 5 )
{
子_in_11 = 子_in_11 + 1;
if ( ( 子_do_18>子_do_2 || 子_do_18==0.0 ) )
{
子_do_18 = 子_do_2 ;
}
子_in_14 = OrderTicket() ;
子_do_20 = 子_do_2 ;
}
if ( 子_in_12 == 0 )
{
子_in_8 = 子_in_8 + 1;
子_do_5 = 子_do_5 + 子_do_7 ;
子_do_22 = 子_do_2 * 子_do_7 + 子_do_22 ;
if ( ( 子_do_15<子_do_2 || 子_do_15==0.0 ) )
{
子_do_15 = 子_do_2 ;
}
if ( ( 子_do_16>子_do_2 || 子_do_16==0.0 ) )
{
子_do_16 = 子_do_2 ;
}
子_do_4 = OrderProfit() + OrderSwap() + OrderCommission() + 子_do_4 ;
}
if ( 子_in_12 != 1 ) continue;
子_in_9 = 子_in_9 + 1;
子_do_6 = 子_do_6 + 子_do_7 ;
子_do_21 = 子_do_2 * 子_do_7 + 子_do_21 ;
if ( ( 子_do_18>子_do_2 || 子_do_18==0.0 ) )
{
子_do_18 = 子_do_2 ;
}
if ( ( 子_do_17<子_do_2 || 子_do_17==0.0 ) )
{
子_do_17 = 子_do_2 ;
}
子_do_3 = OrderProfit() + OrderSwap() + OrderCommission() + 子_do_3 ;
}
if ( 子_do_4>0.0 )
{
ObjectSetInteger(0,总_st_35,OBJPROP_BGCOLOR,17919);
}
else
{
ObjectSetInteger(0,总_st_35,OBJPROP_BGCOLOR,6908265);
}
if ( 子_do_3>0.0 )
{
ObjectSetInteger(0,总_st_36,OBJPROP_BGCOLOR,17919);
}
else
{
ObjectSetInteger(0,总_st_36,OBJPROP_BGCOLOR,6908265);
}
if ( 子_do_4 + 子_do_3>0.0 )
{
ObjectSetInteger(0,总_st_37,OBJPROP_BGCOLOR,17919);
}
else
{
ObjectSetInteger(0,总_st_37,OBJPROP_BGCOLOR,6908265);
}
if ( 子_do_5>0.0 && 子_do_6 / 子_do_5>3.0 && 子_do_6 - 子_do_5>0.2 )
{
总_bo_11 = true ;
}
else
{
总_bo_11 = false ;
}
if ( 子_do_6>0.0 && 子_do_5 / 子_do_6>3.0 && 子_do_5 - 子_do_6>0.2 )
{
总_bo_12 = true ;
}
else
{
总_bo_12 = false ;
}
子_do_35 = 0.0 ;
子_do_36 = 0.0 ;
子_do_37 = 0.0 ;
子_do_38 = 0.0 ;
子_do_35 = iHigh(Symbol(),总_in_3,0) - iLow(Symbol(),总_in_3,5) ;
子_do_37 = iLow(Symbol(),总_in_3,0) - iHigh(Symbol(),总_in_3,5) ;
子_do_36 = int(子_do_35 / Point()) ;
子_do_38 = MathAbs(子_do_37 / Point()) ;
if ( ( AccountLeverage() < Leverage || IsTradeAllowed() == false || IsExpertEnabled() == false || IsStopped() || 子_in_8 + 子_in_9 >= Totals || MarketInfo(Symbol(),13)>MaxSpread || ( 总_in_4 != 0 && 子_do_36>=总_in_4 ) || (总_in_4 != 0 && 子_do_38>=总_in_4) ) )
{
总_bo_1 = false ;
总_bo_2 = false ;
临_st_3 = "Arial";
临_st_4 = "This EA has stop work ! ";
if ( ObjectFind("Stop") == -1 )
{
ObjectCreate("Stop",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Stop",OBJPROP_CORNER,总_in_46);
ObjectSet("Stop",OBJPROP_XDISTANCE,总_in_47);
ObjectSet("Stop",OBJPROP_YDISTANCE,总_in_48 + 30);
}
ObjectSetText("Stop",临_st_4,总_in_5,临_st_3,总_ui_31);
}
else
{
总_bo_1 = true ;
总_bo_2 = true ;
临_st_5 = "Arial";
临_st_6 = "";
if ( ObjectFind("Stop") == -1 )
{
ObjectCreate("Stop",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Stop",OBJPROP_CORNER,总_in_46);
ObjectSet("Stop",OBJPROP_XDISTANCE,总_in_47);
ObjectSet("Stop",OBJPROP_YDISTANCE,总_in_48 + 30);
}
ObjectSetText("Stop",临_st_6,总_in_5,临_st_5,总_ui_31);
}
临_da_7 = 0;
if ( IsTesting() )
{
临_da_7 = TimeCurrent();
}
else
{
临_da_7 = TimeLocal();
}
总_da_63 = StringToTime(StringConcatenate(TimeYear(临_da_7),".",TimeMonth(临_da_7),".",TimeDay(临_da_7)," ",EA_StartTime)) ;
总_da_64 = StringToTime(StringConcatenate(TimeYear(临_da_7),".",TimeMonth(临_da_7),".",TimeDay(临_da_7)," ",EA_StopTime)) ;
if ( 总_da_63 < 总_da_64 && ( 临_da_7 < 总_da_63 || 临_da_7 > 总_da_64 ) )
{
临_bo_8 = false;
}
else
{
if ( 总_da_63 > 总_da_64 && 临_da_7 < 总_da_63 && 临_da_7 > 总_da_64 )
{
临_bo_8 = false;
}
else
{
临_bo_8 = true;
}}
if ( !(临_bo_8) )
{
临_st_9 = "Arial";
临_st_10 = "Time out,This EA has stop open order";
if ( ObjectFind("Stop") == -1 )
{
ObjectCreate("Stop",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Stop",OBJPROP_CORNER,总_in_46);
ObjectSet("Stop",OBJPROP_XDISTANCE,总_in_47);
ObjectSet("Stop",OBJPROP_YDISTANCE,总_in_48 + 30);
}
ObjectSetText("Stop",临_st_10,总_in_5,临_st_9,总_ui_31);
}
if ( 总_st_50 != WindowExpertName() )
{
总_bo_1 = false ;
总_bo_2 = false ;
临_st_11 = "Arial";
临_st_12 = "This EA has stop work ! ";
if ( ObjectFind("Stop") == -1 )
{
ObjectCreate("Stop",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Stop",OBJPROP_CORNER,总_in_46);
ObjectSet("Stop",OBJPROP_XDISTANCE,总_in_47);
ObjectSet("Stop",OBJPROP_YDISTANCE,总_in_48 + 30);
}
ObjectSetText("Stop",临_st_12,总_in_5,临_st_11,总_ui_31);
}
if ( TimeCurrent() < 总_da_9 )
{
临_da_13 = 0;
if ( IsTesting() )
{
临_da_13 = TimeCurrent();
}
else
{
临_da_13 = TimeLocal();
}
总_da_63 = StringToTime(StringConcatenate(TimeYear(临_da_13),".",TimeMonth(临_da_13),".",TimeDay(临_da_13)," ",EA_StartTime)) ;
总_da_64 = StringToTime(StringConcatenate(TimeYear(临_da_13),".",TimeMonth(临_da_13),".",TimeDay(临_da_13)," ",EA_StopTime)) ;
if ( 总_da_63 < 总_da_64 && ( 临_da_13 < 总_da_63 || 临_da_13 > 总_da_64 ) )
{
临_bo_14 = false;
}
else
{
if ( 总_da_63 > 总_da_64 && 临_da_13 < 总_da_63 && 临_da_13 > 总_da_64 )
{
临_bo_14 = false;
}
else
{
临_bo_14 = true;
}}
if ( 临_bo_14 )
{
总_bo_1 = false ;
总_bo_2 = false ;
临_st_15 = "Arial";
临_st_16 = "This EA has stop work " + string(NextTime) + "second! ";
if ( ObjectFind("Stop") == -1 )
{
ObjectCreate("Stop",OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet("Stop",OBJPROP_CORNER,总_in_46);
ObjectSet("Stop",OBJPROP_XDISTANCE,总_in_47);
ObjectSet("Stop",OBJPROP_YDISTANCE,总_in_48 + 30);
}
ObjectSetText("Stop",临_st_16,总_in_5,临_st_15,总_ui_31);
}}
if ( Over == 1 && 子_in_8 == 0 )
{
总_bo_1 = false ;
}
if ( Over == 1 && 子_in_9 == 0 )
{
总_bo_2 = false ;
}
ObjectDelete("SLb");
ObjectDelete("SLs");
if ( 子_in_8 > 0 )
{
子_do_23 = NormalizeDouble(子_do_22 / 子_do_5,Digits()) ;
ObjectCreate("SLb",OBJ_ARROW,0,Time[0],子_do_23,0,0.0,0,0.0);
ObjectSet("SLb",OBJPROP_ARROWCODE,6.0);
ObjectSet("SLb",OBJPROP_COLOR,总_ui_7);
}
if ( 子_in_9 > 0 )
{
子_do_24 = NormalizeDouble(子_do_21 / 子_do_6,Digits()) ;
ObjectCreate("SLs",OBJ_ARROW,0,Time[0],子_do_24,0,0.0,0,0.0);
ObjectSet("SLs",OBJPROP_ARROWCODE,6.0);
ObjectSet("SLs",OBJPROP_COLOR,总_ui_8);
}
ObjectSetText("Char.op",CharToString(74),总_in_5 + 2,"Wingdings",Red);
子_do_39 = 子_do_4 + 子_do_3 ;
if ( Over == 1 && 子_do_39>=CloseAll )
{
总_bo_1 = false ;
总_bo_2 = false ;
临_st_17 = "Ticket";
临_st_18 = "sell";
临_in_19 = 0;
临_do_20 = 0.0;
for (临_in_21 = OrdersTotal() - 1 ; 临_in_21 >= 0 ; 临_in_21 = 临_in_21 - 1)
{
if ( !(OrderSelect(临_in_21,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_18 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_19 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_20 = OrderLots();
临_in_19 = OrderTicket();
}
if ( 临_st_18 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_19 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_20 = OrderLots();
临_in_19 = OrderTicket();
}
if ( 临_st_17 == "Ticket" )
{
临_do_22 = 临_in_19;
}
else
{
if ( 临_st_17 == "Lots" )
{
临_do_22 = 临_do_20;
}
else
{
临_do_22 = 0.0;
}}
临_in_23 = 临_do_22;
临_st_24 = "Ticket";
临_st_25 = "buy";
临_in_26 = 0;
临_do_27 = 0.0;
for (临_in_28 = OrdersTotal() - 1 ; 临_in_28 >= 0 ; 临_in_28 = 临_in_28 - 1)
{
if ( !(OrderSelect(临_in_28,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_25 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_26 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_27 = OrderLots();
临_in_26 = OrderTicket();
}
if ( 临_st_25 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_26 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_27 = OrderLots();
临_in_26 = OrderTicket();
}
if ( 临_st_24 == "Ticket" )
{
临_do_29 = 临_in_26;
}
else
{
if ( 临_st_24 == "Lots" )
{
临_do_29 = 临_do_27;
}
else
{
临_do_29 = 0.0;
}}
if(OrderCloseBy(临_do_29,临_in_23,0xFFFFFFFF)){
do
{
临_st_30 = "Ticket";
临_st_31 = "sell";
临_in_32 = 0;
临_do_33 = 0.0;
for (临_in_34 = OrdersTotal() - 1 ; 临_in_34 >= 0 ; 临_in_34 = 临_in_34 - 1)
{
if ( !(OrderSelect(临_in_34,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_31 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_32 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_33 = OrderLots();
临_in_32 = OrderTicket();
}
if ( 临_st_31 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_32 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_33 = OrderLots();
临_in_32 = OrderTicket();
}
if ( 临_st_30 == "Ticket" )
{
临_do_35 = 临_in_32;
}
else
{
if ( 临_st_30 == "Lots" )
{
临_do_35 = 临_do_33;
}
else
{
临_do_35 = 0.0;
}}
临_in_36 = 临_do_35;
临_st_37 = "Ticket";
临_st_38 = "buy";
临_in_39 = 0;
临_do_40 = 0.0;
for (临_in_41 = OrdersTotal() - 1 ; 临_in_41 >= 0 ; 临_in_41 = 临_in_41 - 1)
{
if ( !(OrderSelect(临_in_41,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_38 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_39 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_40 = OrderLots();
临_in_39 = OrderTicket();
}
if ( 临_st_38 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_39 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_40 = OrderLots();
临_in_39 = OrderTicket();
}
if ( 临_st_37 == "Ticket" )
{
临_do_42 = 临_in_39;
}
else
{
if ( 临_st_37 == "Lots" )
{
临_do_42 = 临_do_40;
}
else
{
临_do_42 = 0.0;
}}
}
while(OrderCloseBy(临_do_42,临_in_36,0xFFFFFFFF));
}
lizong_7(0);
if ( ObjectFind(总_st_32) < 0 )
{
ObjectCreate(总_st_32,OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet(总_st_32,OBJPROP_CORNER,1.0);
ObjectSet(总_st_32,OBJPROP_YDISTANCE,260.0);
ObjectSet(总_st_32,OBJPROP_XDISTANCE,10.0);
ObjectSetText(总_st_32,"Spread: " + DoubleToString((Ask - Bid) / 总_do_30,1) + " pips",13,"Arial",总_ui_31);
}
ObjectSetText(总_st_32,"Spread: " + DoubleToString((Ask - Bid) / 总_do_30,1) + " pips",0,NULL,0xFFFFFFFF);
WindowRedraw();
WindowRedraw();
}
if ( Over == false )
{
if ( HomeopathyCloseAll == true )
{
临_st_43 = "buy";
临_in_44 = 0;
for (临_in_45 = OrdersTotal() - 1 ; 临_in_45 >= 0 ; 临_in_45=临_in_45 - 1)
{
if ( !(OrderSelect(临_in_45,SELECT_BY_POS,MODE_TRADES)) || Symbol() != OrderSymbol() || OrderMagicNumber() != Magic || OrderComment() != "SS" ) continue;
if ( 临_st_43 == "buy" && OrderType() == 0 )
{
临_in_44 = 临_in_44 + 1;
}
if ( 临_st_43 != "sell" || OrderType() != 1 ) continue;
临_in_44 = 临_in_44 + 1;
}
if ( 临_in_44 < 1 )
{
临_st_46 = "sell";
临_in_47 = 0;
for (临_in_48 = OrdersTotal() - 1 ; 临_in_48 >= 0 ; 临_in_48=临_in_48 - 1)
{
if ( !(OrderSelect(临_in_48,SELECT_BY_POS,MODE_TRADES)) || Symbol() != OrderSymbol() || OrderMagicNumber() != Magic || OrderComment() != "SS" ) continue;
if ( 临_st_46 == "buy" && OrderType() == 0 )
{
临_in_47 = 临_in_47 + 1;
}
if ( 临_st_46 != "sell" || OrderType() != 1 ) continue;
临_in_47 = 临_in_47 + 1;
}
}}
if ( ( 临_in_47 < 1 || HomeopathyCloseAll == false ) && 子_do_4>MaxLossCloseAll && 子_do_3>MaxLossCloseAll )
{
ObjectSetText("Char.op",CharToString(251),总_in_5 + 2,"Wingdings",Silver);
if ( ( ( Profit == true && 子_do_4>StopProfit * 子_in_8 ) || (Profit == false && 子_do_4>StopProfit) ) )
{
Print("Buy Profit ",子_do_4);
lizong_7(1);
return(0);
}
if ( ( ( Profit == true && 子_do_3>StopProfit * 子_in_9 ) || (Profit == false && 子_do_3>StopProfit) ) )
{
Print("Sell Profit ",子_do_3);
lizong_7(-1);
return(0);
}}
if ( HomeopathyCloseAll == true )
{
临_st_49 = "buy";
临_in_50 = 0;
for (临_in_51 = OrdersTotal() - 1 ; 临_in_51 >= 0 ; 临_in_51=临_in_51 - 1)
{
if ( !(OrderSelect(临_in_51,SELECT_BY_POS,MODE_TRADES)) || Symbol() != OrderSymbol() || OrderMagicNumber() != Magic || OrderComment() != "SS" ) continue;
if ( 临_st_49 == "buy" && OrderType() == 0 )
{
临_in_50 = 临_in_50 + 1;
}
if ( 临_st_49 != "sell" || OrderType() != 1 ) continue;
临_in_50 = 临_in_50 + 1;
}
临_st_52 = "sell";
临_in_53 = 0;
for (临_in_54 = OrdersTotal() - 1 ; 临_in_54 >= 0 ; 临_in_54=临_in_54 - 1)
{
if ( !(OrderSelect(临_in_54,SELECT_BY_POS,MODE_TRADES)) || Symbol() != OrderSymbol() || OrderMagicNumber() != Magic || OrderComment() != "SS" ) continue;
if ( 临_st_52 == "buy" && OrderType() == 0 )
{
临_in_53 = 临_in_53 + 1;
}
if ( 临_st_52 != "sell" || OrderType() != 1 ) continue;
临_in_53 = 临_in_53 + 1;
}
if ( ( 临_in_50 > 0 || 临_in_53 > 0 ) && 子_do_4 + 子_do_3>=CloseAll )
{
临_st_55 = "Ticket";
临_st_56 = "sell";
临_in_57 = 0;
临_do_58 = 0.0;
for (临_in_59 = OrdersTotal() - 1 ; 临_in_59 >= 0 ; 临_in_59 = 临_in_59 - 1)
{
if ( !(OrderSelect(临_in_59,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_56 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_57 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_58 = OrderLots();
临_in_57 = OrderTicket();
}
if ( 临_st_56 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_57 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_58 = OrderLots();
临_in_57 = OrderTicket();
}
if ( 临_st_55 == "Ticket" )
{
临_do_60 = 临_in_57;
}
else
{
if ( 临_st_55 == "Lots" )
{
临_do_60 = 临_do_58;
}
else
{
临_do_60 = 0.0;
}}
临_in_61 = 临_do_60;
临_st_62 = "Ticket";
临_st_63 = "buy";
临_in_64 = 0;
临_do_65 = 0.0;
for (临_in_66 = OrdersTotal() - 1 ; 临_in_66 >= 0 ; 临_in_66 = 临_in_66 - 1)
{
if ( !(OrderSelect(临_in_66,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_63 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_64 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_65 = OrderLots();
临_in_64 = OrderTicket();
}
if ( 临_st_63 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_64 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_65 = OrderLots();
临_in_64 = OrderTicket();
}
if ( 临_st_62 == "Ticket" )
{
临_do_67 = 临_in_64;
}
else
{
if ( 临_st_62 == "Lots" )
{
临_do_67 = 临_do_65;
}
else
{
临_do_67 = 0.0;
}}
if(OrderCloseBy(临_do_67,临_in_61,0xFFFFFFFF)){
do
{
临_st_68 = "Ticket";
临_st_69 = "sell";
临_in_70 = 0;
临_do_71 = 0.0;
for (临_in_72 = OrdersTotal() - 1 ; 临_in_72 >= 0 ; 临_in_72 = 临_in_72 - 1)
{
if ( !(OrderSelect(临_in_72,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_69 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_70 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_71 = OrderLots();
临_in_70 = OrderTicket();
}
if ( 临_st_69 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_70 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_71 = OrderLots();
临_in_70 = OrderTicket();
}
if ( 临_st_68 == "Ticket" )
{
临_do_73 = 临_in_70;
}
else
{
if ( 临_st_68 == "Lots" )
{
临_do_73 = 临_do_71;
}
else
{
临_do_73 = 0.0;
}}
临_in_74 = 临_do_73;
临_st_75 = "Ticket";
临_st_76 = "buy";
临_in_77 = 0;
临_do_78 = 0.0;
for (临_in_79 = OrdersTotal() - 1 ; 临_in_79 >= 0 ; 临_in_79 = 临_in_79 - 1)
{
if ( !(OrderSelect(临_in_79,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_76 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_77 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_78 = OrderLots();
临_in_77 = OrderTicket();
}
if ( 临_st_76 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_77 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_78 = OrderLots();
临_in_77 = OrderTicket();
}
if ( 临_st_75 == "Ticket" )
{
临_do_80 = 临_in_77;
}
else
{
if ( 临_st_75 == "Lots" )
{
临_do_80 = 临_do_78;
}
else
{
临_do_80 = 0.0;
}}
}
while(OrderCloseBy(临_do_80,临_in_74,0xFFFFFFFF));
}
lizong_7(0);
if ( NextTime > 0 )
{
总_da_9=TimeCurrent() + NextTime;
}
return(0);
}}
if ( 子_do_4 + 子_do_3>=CloseAll && ( 子_do_4<=MaxLossCloseAll || 子_do_3<=MaxLossCloseAll ) )
{
临_st_81 = "Ticket";
临_st_82 = "sell";
临_in_83 = 0;
临_do_84 = 0.0;
for (临_in_85 = OrdersTotal() - 1 ; 临_in_85 >= 0 ; 临_in_85 = 临_in_85 - 1)
{
if ( !(OrderSelect(临_in_85,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_82 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_83 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_84 = OrderLots();
临_in_83 = OrderTicket();
}
if ( 临_st_82 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_83 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_84 = OrderLots();
临_in_83 = OrderTicket();
}
if ( 临_st_81 == "Ticket" )
{
临_do_86 = 临_in_83;
}
else
{
if ( 临_st_81 == "Lots" )
{
临_do_86 = 临_do_84;
}
else
{
临_do_86 = 0.0;
}}
临_in_87 = 临_do_86;
临_st_88 = "Ticket";
临_st_89 = "buy";
临_in_90 = 0;
临_do_91 = 0.0;
for (临_in_92 = OrdersTotal() - 1 ; 临_in_92 >= 0 ; 临_in_92 = 临_in_92 - 1)
{
if ( !(OrderSelect(临_in_92,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_89 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_90 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_91 = OrderLots();
临_in_90 = OrderTicket();
}
if ( 临_st_89 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_90 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_91 = OrderLots();
临_in_90 = OrderTicket();
}
if ( 临_st_88 == "Ticket" )
{
临_do_93 = 临_in_90;
}
else
{
if ( 临_st_88 == "Lots" )
{
临_do_93 = 临_do_91;
}
else
{
临_do_93 = 0.0;
}}
if(OrderCloseBy(临_do_93,临_in_87,0xFFFFFFFF)){
do
{
临_st_94 = "Ticket";
临_st_95 = "sell";
临_in_96 = 0;
临_do_97 = 0.0;
for (临_in_98 = OrdersTotal() - 1 ; 临_in_98 >= 0 ; 临_in_98 = 临_in_98 - 1)
{
if ( !(OrderSelect(临_in_98,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_95 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_96 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_97 = OrderLots();
临_in_96 = OrderTicket();
}
if ( 临_st_95 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_96 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_97 = OrderLots();
临_in_96 = OrderTicket();
}
if ( 临_st_94 == "Ticket" )
{
临_do_99 = 临_in_96;
}
else
{
if ( 临_st_94 == "Lots" )
{
临_do_99 = 临_do_97;
}
else
{
临_do_99 = 0.0;
}}
临_in_100 = 临_do_99;
临_st_101 = "Ticket";
临_st_102 = "buy";
临_in_103 = 0;
临_do_104 = 0.0;
for (临_in_105 = OrdersTotal() - 1 ; 临_in_105 >= 0 ; 临_in_105 = 临_in_105 - 1)
{
if ( !(OrderSelect(临_in_105,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_102 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_103 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_104 = OrderLots();
临_in_103 = OrderTicket();
}
if ( 临_st_102 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_103 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_104 = OrderLots();
临_in_103 = OrderTicket();
}
if ( 临_st_101 == "Ticket" )
{
临_do_106 = 临_in_103;
}
else
{
if ( 临_st_101 == "Lots" )
{
临_do_106 = 临_do_104;
}
else
{
临_do_106 = 0.0;
}}
}
while(OrderCloseBy(临_do_106,临_in_100,0xFFFFFFFF));
}
lizong_7(0);
if ( NextTime > 0 )
{
总_da_9=TimeCurrent() + NextTime;
}
return(0);
}}
if ( StopLoss!=0.0 && 子_do_4 + 子_do_3<=StopLoss )
{
Print("Buy Loss ",子_do_4);
Print("Sell Loss ",子_do_3);
lizong_7(0);
if ( NextTime > 0 )
{
总_da_9=TimeCurrent() + NextTime;
}
return(0);
}
if ( 子_do_4<=MaxLoss )
{
Comment("Buy");
ObjectSetText("Char.b",CharToString(225) + CharToString(251),总_in_5,"Wingdings",Red);
}
else
{
ObjectSetText("Char.b",CharToString(233),总_in_5,"Wingdings",Lime);
}
if ( 子_do_3<=MaxLoss )
{
Comment("Sell");
ObjectSetText("Char.s",CharToString(226) + CharToString(251),总_in_5,"Wingdings",Red);
}
else
{
ObjectSetText("Char.s",CharToString(234),总_in_5,"Wingdings",Lime);
}
if ( iOpen(Symbol(),1,0)>iOpen(Symbol(),1,1) )
{
总_in_40 = 总_in_38 ;
}
if ( iOpen(Symbol(),1,0)<iOpen(Symbol(),1,1) )
{
总_in_40 = 总_in_39 ;
}
if ( iClose(Symbol(),1,0)>iClose(Symbol(),1,1) )
{
总_in_40 = 总_in_42 ;
}
if ( iClose(Symbol(),1,0)<iClose(Symbol(),1,1) )
{
总_in_40 = 总_in_43 ;
}
子_do_28 = (Ask - Bid) / Point() ;
子_st_29 = Symbol() + ": " + DoubleToString(子_do_28,1) + " pips" ;
ObjectCreate(总_st_32,OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet(总_st_32,OBJPROP_CORNER,1.0);
ObjectSet(总_st_32,OBJPROP_YDISTANCE,340.0);
ObjectSet(总_st_32,OBJPROP_XDISTANCE,10.0);
ObjectSetText(总_st_32,子_st_29,13,"Arial",总_ui_31);
子_do_30 = AccountLeverage() ;
子_st_31 = "Lever: " + DoubleToString(子_do_30,0) + " multi" ;
ObjectCreate(总_st_44,OBJ_LABEL,0,0,0.0,0,0.0,0,0.0);
ObjectSet(总_st_44,OBJPROP_CORNER,1.0);
ObjectSet(总_st_44,OBJPROP_YDISTANCE,320.0);
ObjectSet(总_st_44,OBJPROP_XDISTANCE,10.0);
ObjectSetText(总_st_44,子_st_31,13,"Arial",总_ui_31);
if ( CloseBuySell == 1 )
{
子_do_32 = lizong_10(0,Magic,1,总_in_28) - lizong_10(0,Magic,2,总_in_29) ;
if ( 总_do_23<子_do_32 )
{
总_do_23 = 子_do_32 ;
}
if ( 总_do_23>0.0 && 子_do_32>0.0 && 总_do_23>0.0 )
{
临_in_107 = 1;
临_in_108 = Magic;
临_in_109 = 0;
临_do_110 = 0.0;
临_do_111 = 0.0;
for (临_in_112 = OrdersTotal() - 1 ; 临_in_112 >= 0 ; 临_in_112 = 临_in_112 - 1)
{
if ( !(OrderSelect(临_in_112,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || ( OrderMagicNumber() != 临_in_108 && 临_in_108 != -1 ) || ( OrderType() != 临_in_109 && 临_in_109 != -100 ) ) continue;
if ( 临_in_107 == 1 && 临_do_111<OrderProfit() )
{
临_do_111 = OrderProfit();
临_do_110 = OrderLots();
}
if ( 临_in_107 != 2 || ( !(临_do_111>OrderProfit()) && !(临_do_111==0.0) ) ) continue;
临_do_111 = OrderProfit();
临_do_110 = OrderLots();
}
if ( 子_do_5>临_do_110 * 3.0 + 子_do_6 && 子_in_8 > 3 )
{
lizong_9(0,Magic,总_in_28,1);
lizong_9(0,Magic,总_in_29,2);
总_do_23 = 0.0 ;
总_do_24 = 0.0 ;
}}
子_do_32 = lizong_10(1,Magic,1,总_in_28) - lizong_10(1,Magic,2,总_in_29) ;
if ( 总_do_24<子_do_32 )
{
总_do_24 = 子_do_32 ;
}
if ( 总_do_24>0.0 && 子_do_32>0.0 && 总_do_24>0.0 )
{
临_in_113 = 1;
临_in_114 = Magic;
临_in_115 = 1;
临_do_116 = 0.0;
临_do_117 = 0.0;
for (临_in_118 = OrdersTotal() - 1 ; 临_in_118 >= 0 ; 临_in_118 = 临_in_118 - 1)
{
if ( !(OrderSelect(临_in_118,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || ( OrderMagicNumber() != 临_in_114 && 临_in_114 != -1 ) || ( OrderType() != 临_in_115 && 临_in_115 != -100 ) ) continue;
if ( 临_in_113 == 1 && 临_do_117<OrderProfit() )
{
临_do_117 = OrderProfit();
临_do_116 = OrderLots();
}
if ( 临_in_113 != 2 || ( !(临_do_117>OrderProfit()) && !(临_do_117==0.0) ) ) continue;
临_do_117 = OrderProfit();
临_do_116 = OrderLots();
}
if ( 子_do_6>临_do_116 * 3.0 + 子_do_5 && 子_in_9 > 3 )
{
lizong_9(1,Magic,总_in_28,1);
lizong_9(1,Magic,总_in_29,2);
总_do_23 = 0.0 ;
总_do_24 = 0.0 ;
}}}
if ( ( ( Money!=0.0 && 子_do_39>Money ) || Money==0.0 ) )
{
子_bo_34 = true ;
}
if ( Money!=0.0 && 子_do_39<=Money )
{
子_bo_34 = false ;
}
if ( ( ( OpenMode == 1 && 总_da_62 != iTime(NULL,TimeZone,0) ) || OpenMode == 2 || OpenMode == 3 ) )
{
if ( 子_in_10 == 0 && 子_do_4>MaxLoss && 总_bo_1 )
{
if ( 子_in_8 == 0 )
{
子_do_25 = NormalizeDouble(FirstStep * Point() + Ask,Digits()) ;
}
else
{
if ( 子_bo_34 )
{
子_do_25 = NormalizeDouble(MinDistance * Point() + Ask,Digits()) ;
}
if ( 子_bo_34 == false && Money!=0.0 )
{
子_do_25 = NormalizeDouble(TwoMinDistance * Point() + Ask,Digits()) ;
}
if ( 子_do_25<NormalizeDouble(子_do_16 - Step * Point(),Digits()) && 子_bo_34 )
{
子_do_25 = NormalizeDouble(Step * Point() + Ask,Digits()) ;
}
if ( 子_do_25<NormalizeDouble(子_do_16 - TwoStep * Point(),Digits()) && 子_bo_34 == false && Money!=0.0 )
{
子_do_25 = NormalizeDouble(TwoStep * Point() + Ask,Digits()) ;
}}
if ( ( 子_in_8 == 0 || ( 子_do_15!=0.0 && 子_do_25>=NormalizeDouble(Step * Point() + 子_do_15,Digits()) && 总_bo_11 && 子_bo_34 ) || ( 子_do_15!=0.0 && 子_do_25>=NormalizeDouble(TwoStep * Point() + 子_do_15,Digits()) && 总_bo_11 && 子_bo_34 == false && Money!=0.0 ) || ( 子_do_16!=0.0 && 子_do_25<=NormalizeDouble(子_do_16 - Step * Point(),Digits()) && 子_bo_34 ) || ( 子_do_16!=0.0 && 子_do_25<=NormalizeDouble(子_do_16 - TwoStep * Point(),Digits()) && 子_bo_34 == false && Money!=0.0 ) || (Homeopathy && 子_do_15!=0.0 && 子_do_25>=NormalizeDouble(Step * Point() + 子_do_15,Digits()) && 子_do_5==子_do_6) ) )
{
if ( 子_in_8 == 0 )
{
子_do_26 = lot ;
}
else
{
子_do_26 = NormalizeDouble(lot * MathPow(K_Lot,子_in_8) + 子_in_8 * PlusLot,DigitsLot) ;
}
if ( 子_do_26>Maxlot )
{
子_do_26 = Maxlot ;
}
if ( ( ( 子_do_26 * 2.0<AccountFreeMargin() / MarketInfo(Symbol(),32) && 子_in_8 > 0 ) || 总_bo_10 ) )
{
临_da_119 = 0;
if ( IsTesting() )
{
临_da_119 = TimeCurrent();
}
else
{
临_da_119 = TimeLocal();
}
总_da_63 = StringToTime(StringConcatenate(TimeYear(临_da_119),".",TimeMonth(临_da_119),".",TimeDay(临_da_119)," ",EA_StartTime)) ;
总_da_64 = StringToTime(StringConcatenate(TimeYear(临_da_119),".",TimeMonth(临_da_119),".",TimeDay(临_da_119)," ",EA_StopTime)) ;
if ( 总_da_63 < 总_da_64 && ( 临_da_119 < 总_da_63 || 临_da_119 > 总_da_64 ) )
{
临_bo_120 = false;
}
else
{
if ( 总_da_63 > 总_da_64 && 临_da_119 < 总_da_63 && 临_da_119 > 总_da_64 )
{
临_bo_120 = false;
}
else
{
临_bo_120 = true;
}}
临_da_121 = 0;
if ( 临_bo_120 )
{
if ( IsTesting() )
{
临_da_121 = TimeCurrent();
}
else
{
临_da_121 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_121),".",TimeMonth(临_da_121),".",TimeDay(临_da_121)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_121),".",TimeMonth(临_da_121),".",TimeDay(临_da_121)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_121 < 总_da_63 || 临_da_121 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_122 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_121 < 总_da_65 && 临_da_121 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_122 = false;
}
else
{
临_bo_122 = true;
}}
临_da_123 = 0;
if ( IsTesting() )
{
临_da_123 = TimeCurrent();
}
else
{
临_da_123 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_123),".",TimeMonth(临_da_123),".",TimeDay(临_da_123)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_123),".",TimeMonth(临_da_123),".",TimeDay(临_da_123)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_123 < 总_da_63 || 临_da_123 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_124 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_123 < 总_da_65 && 临_da_123 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_124 = false;
}
else
{
临_bo_124 = true;
}}
if ( !(临_bo_124) )
{
临_da_125 = 0;
if ( IsTesting() )
{
临_da_125 = TimeCurrent();
}
else
{
临_da_125 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_125),".",TimeMonth(临_da_125),".",TimeDay(临_da_125)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_125),".",TimeMonth(临_da_125),".",TimeDay(临_da_125)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_125 < 总_da_63 || 临_da_125 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_126 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_125 < 总_da_65 && 临_da_125 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_126 = false;
}
else
{
临_bo_126 = true;
}}
// if ( ( (临_bo_126 && 子_in_8 >= 1) ) )
// {
临_da_127 = 0;
if ( IsTesting() )
{
临_da_127 = TimeCurrent();
}
else
{
临_da_127 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_127),".",TimeMonth(临_da_127),".",TimeDay(临_da_127)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_127),".",TimeMonth(临_da_127),".",TimeDay(临_da_127)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_127 < 总_da_63 || 临_da_127 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_128 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_127 < 总_da_65 && 临_da_127 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_128 = false;
}
else
{
临_bo_128 = true;
}}
临_da_129 = 0;
if ( IsTesting() )
{
临_da_129 = TimeCurrent();
}
else
{
临_da_129 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_129),".",TimeMonth(临_da_129),".",TimeDay(临_da_129)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_129),".",TimeMonth(临_da_129),".",TimeDay(临_da_129)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_129 < 总_da_63 || 临_da_129 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_130 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_129 < 总_da_65 && 临_da_129 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_130 = false;
}
else
{
临_bo_130 = true;
}}
}
// Print("总_da_65=",总_da_65," 总_da_66=",总_da_66," 临_da_123=",临_da_123," 总_da_63=",总_da_63," 临_da_123=",临_da_123);
if ( ( On_top_of_this_price_not_Buy_order==0.0 || ( 临_bo_128 && 子_in_8 >= 1 && 子_do_25<On_top_of_this_price_not_Buy_order ) || 子_in_8 == 0 || !(临_bo_130) ) )
{
临_in_131 = 0;
临_in_132 = Magic;
临_in_133 = 0;
临_in_134 = 0;
for (临_in_135 = OrdersTotal() - 1 ; 临_in_135 >= 0 ; 临_in_135=临_in_135 - 1)
{
if ( !(OrderSelect(临_in_135,SELECT_BY_POS,MODE_TRADES)) || Symbol() != OrderSymbol() || OrderMagicNumber() != 临_in_132 || OrderTicket() <= 临_in_134 || OrderType() != 临_in_131 ) continue;
临_in_134 = OrderTicket();
临_in_133 = OrderOpenTime();
}
if ( ( ( TimeCurrent() - 临_in_133 >= sleep && OpenMode == 2 ) || OpenMode == 3 || OpenMode == 1 ) )
{
if ( ( ( 子_do_15!=0.0 && 子_do_25>=NormalizeDouble(Step * Point() + 子_do_15,Digits()) && 总_bo_11 && 子_bo_34 ) || ( 子_do_15!=0.0 && 子_do_25>=NormalizeDouble(TwoStep * Point() + 子_do_15,Digits()) && 总_bo_11 && 子_bo_34 == false && Money!=0.0 ) || (Homeopathy && 子_do_15!=0.0 && 子_do_25>=NormalizeDouble(Step * Point() + 子_do_15,Digits()) && 子_do_5==子_do_6) ) )
{
总_in_69 = OrderSend(Symbol(),OP_BUYSTOP,子_do_26,子_do_25,总_in_22,0.0,0.0,"SS",Magic,0,Blue) ;
if ( 总_in_69 > 0 )
{
Print(Symbol() + "开单成功,订单编号:" + DoubleToString(总_in_69,0));
}
else
{
Print(Symbol() + "开单失败");
}}
else
{
总_in_69 = OrderSend(Symbol(),OP_BUYSTOP,子_do_26,子_do_25,总_in_22,0.0,0.0,"NN",Magic,0,Blue) ;
if ( 总_in_69 > 0 )
{
Print(Symbol() + "开单成功,订单编号:" + DoubleToString(总_in_69,0));
}
else
{
Print(Symbol() + "开单失败");
}}}}}}
else
{
Comment("Lot ",DoubleToString(子_do_26,2));
}}}
if ( 子_in_11 == 0 && 子_do_3>MaxLoss && 总_bo_2 )
{
if ( 子_in_9 == 0 )
{
子_do_25 = NormalizeDouble(Bid - FirstStep * Point(),Digits()) ;
}
else
{
if ( 子_bo_34 )
{
子_do_25 = NormalizeDouble(Bid - MinDistance * Point(),Digits()) ;
}
if ( 子_bo_34 == false )
{
子_do_25 = NormalizeDouble(Bid - TwoMinDistance * Point(),Digits()) ;
}
if ( 子_do_25<NormalizeDouble(Step * Point() + 子_do_17,Digits()) && 子_bo_34 )
{
子_do_25 = NormalizeDouble(Bid - Step * Point(),Digits()) ;
}
if ( 子_do_25<NormalizeDouble(TwoStep * Point() + 子_do_17,Digits()) && 子_bo_34 == false && Money!=0.0 )
{
子_do_25 = NormalizeDouble(Bid - TwoStep * Point(),Digits()) ;
}}
if ( ( 子_in_9 == 0 || ( 子_do_18!=0.0 && 子_do_25<=NormalizeDouble(子_do_18 - Step * Point(),Digits()) && 总_bo_12 && 子_bo_34 ) || ( 子_do_18!=0.0 && 子_do_25<=NormalizeDouble(子_do_18 - TwoStep * Point(),Digits()) && 总_bo_12 && 子_bo_34 == false && Money!=0.0 ) || ( 子_do_17!=0.0 && 子_do_25>=NormalizeDouble(Step * Point() + 子_do_17,Digits()) && 子_bo_34 ) || ( 子_do_17!=0.0 && 子_do_25>=NormalizeDouble(TwoStep * Point() + 子_do_17,Digits()) && 子_bo_34 == false && Money!=0.0 ) || (Homeopathy && 子_do_18!=0.0 && 子_do_25<=NormalizeDouble(子_do_18 - Step * Point(),Digits()) && 子_do_5==子_do_6) ) )
{
if ( 子_in_9 == 0 )
{
子_do_26 = lot ;
}
else
{
子_do_26 = NormalizeDouble(lot * MathPow(K_Lot,子_in_9) + 子_in_9 * PlusLot,DigitsLot) ;
}
if ( 子_do_26>Maxlot )
{
子_do_26 = Maxlot ;
}
if ( ( ( 子_do_26 * 2.0<AccountFreeMargin() / MarketInfo(Symbol(),32) && 子_in_9 > 0 ) || 总_bo_10 ) )
{
临_da_136 = 0;
if ( IsTesting() )
{
临_da_136 = TimeCurrent();
}
else
{
临_da_136 = TimeLocal();
}
总_da_63 = StringToTime(StringConcatenate(TimeYear(临_da_136),".",TimeMonth(临_da_136),".",TimeDay(临_da_136)," ",EA_StartTime)) ;
总_da_64 = StringToTime(StringConcatenate(TimeYear(临_da_136),".",TimeMonth(临_da_136),".",TimeDay(临_da_136)," ",EA_StopTime)) ;
if ( 总_da_63 < 总_da_64 && ( 临_da_136 < 总_da_63 || 临_da_136 > 总_da_64 ) )
{
临_bo_137 = false;
}
else
{
if ( 总_da_63 > 总_da_64 && 临_da_136 < 总_da_63 && 临_da_136 > 总_da_64 )
{
临_bo_137 = false;
}
else
{
临_bo_137 = true;
}}
临_da_138 = 0;
if ( 临_bo_137 )
{
if ( IsTesting() )
{
临_da_138 = TimeCurrent();
}
else
{
临_da_138 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_138),".",TimeMonth(临_da_138),".",TimeDay(临_da_138)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_138),".",TimeMonth(临_da_138),".",TimeDay(临_da_138)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_138 < 总_da_63 || 临_da_138 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_139 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_138 < 总_da_65 && 临_da_138 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_139 = false;
}
else
{
临_bo_139 = true;
}}
临_da_140 = 0;
if ( IsTesting() )
{
临_da_140 = TimeCurrent();
}
else
{
临_da_140 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_140),".",TimeMonth(临_da_140),".",TimeDay(临_da_140)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_140),".",TimeMonth(临_da_140),".",TimeDay(临_da_140)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_140 < 总_da_63 || 临_da_140 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_141 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_140 < 总_da_65 && 临_da_140 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_141 = false;
}
else
{
临_bo_141 = true;
}}
if ( !(临_bo_141) )
{
临_da_142 = 0;
if ( IsTesting() )
{
临_da_142 = TimeCurrent();
}
else
{
临_da_142 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_142),".",TimeMonth(临_da_142),".",TimeDay(临_da_142)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_142),".",TimeMonth(临_da_142),".",TimeDay(临_da_142)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_142 < 总_da_63 || 临_da_142 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_143 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_142 < 总_da_65 && 临_da_142 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_143 = false;
}
else
{
临_bo_143 = true;
}}
//if ( ( (临_bo_143 && 子_in_9 >= 1) ) )
// {
临_da_144 = 0;
if ( IsTesting() )
{
临_da_144 = TimeCurrent();
}
else
{
临_da_144 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_144),".",TimeMonth(临_da_144),".",TimeDay(临_da_144)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_144),".",TimeMonth(临_da_144),".",TimeDay(临_da_144)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_144 < 总_da_63 || 临_da_144 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_145 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_144 < 总_da_65 && 临_da_144 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_145 = false;
}
else
{
临_bo_145 = true;
}}
临_da_146 = 0;
if ( IsTesting() )
{
临_da_146 = TimeCurrent();
}
else
{
临_da_146 = TimeLocal();
}
总_da_65 = StringToTime(StringConcatenate(TimeYear(临_da_146),".",TimeMonth(临_da_146),".",TimeDay(临_da_146)," ",Limit_StartTime)) ;
总_da_66 = StringToTime(StringConcatenate(TimeYear(临_da_146),".",TimeMonth(临_da_146),".",TimeDay(临_da_146)," ",Limit_StopTime)) ;
if ( 总_da_65 < 总_da_66 && ( 临_da_146 < 总_da_63 || 临_da_146 > 总_da_66 ) )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_147 = false;
}
else
{
if ( 总_da_65 > 总_da_66 && 临_da_146 < 总_da_65 && 临_da_146 > 总_da_66 )
{
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
临_bo_147 = false;
}
else
{
临_bo_147 = true;
}}
}
// Print("总_da_65=",总_da_65," 总_da_66=",总_da_66," 临_da_123=",临_da_123," 总_da_63=",总_da_63," 临_da_123=",临_da_123);
if ( ( On_under_of_this_price_not_Sell_order==0.0 || ( 临_bo_145 && 子_in_9 >= 1 && 子_do_25>On_under_of_this_price_not_Sell_order ) || 子_in_9 == 0 || !(临_bo_147) ) )
{
临_in_148 = 1;
临_in_149 = Magic;
临_in_150 = 0;
临_in_151 = 0;
for (临_in_152 = OrdersTotal() - 1 ; 临_in_152 >= 0 ; 临_in_152=临_in_152 - 1)
{
if ( !(OrderSelect(临_in_152,SELECT_BY_POS,MODE_TRADES)) || Symbol() != OrderSymbol() || OrderMagicNumber() != 临_in_149 || OrderTicket() <= 临_in_151 || OrderType() != 临_in_148 ) continue;
临_in_151 = OrderTicket();
临_in_150 = OrderOpenTime();
}
if ( ( ( TimeCurrent() - 临_in_150 >= sleep && OpenMode == 2 ) || OpenMode == 3 || OpenMode == 1 ) )
{
if ( ( ( 子_do_18!=0.0 && 子_do_25<=NormalizeDouble(子_do_18 - Step * Point(),Digits()) && 总_bo_12 && 子_bo_34 ) || ( 子_do_18!=0.0 && 子_do_25<=NormalizeDouble(子_do_18 - TwoStep * Point(),Digits()) && 总_bo_12 && 子_bo_34 == false && Money!=0.0 ) || (Homeopathy && 子_do_18!=0.0 && 子_do_25<=NormalizeDouble(子_do_18 - Step * Point(),Digits()) && 子_do_5==子_do_6) ) )
{
总_in_69 = OrderSend(Symbol(),OP_SELLSTOP,子_do_26,子_do_25,总_in_22,0.0,0.0,"SS",Magic,0,Red) ;
if ( 总_in_69 > 0 )
{
Print(Symbol() + "开单成功,订单编号:" + DoubleToString(总_in_69,0));
}
else
{
Print(Symbol() + "开单失败");
}}
else
{
总_in_69 = OrderSend(Symbol(),OP_SELLSTOP,子_do_26,子_do_25,总_in_22,0.0,0.0,"NN",Magic,0,Red) ;
if ( 总_in_69 > 0 )
{
Print(Symbol() + "开单成功,订单编号:" + DoubleToString(总_in_69,0));
}
else
{
Print(Symbol() + "开单失败");
}}}}}}
else
{
Comment("Lot ",DoubleToString(子_do_26,2));
}}}
总_da_62 = iTime(NULL,TimeZone,0) ;
}
ObjectSetText("Balance",StringConcatenate("馀额 ",DoubleToString(AccountBalance(),2)),总_in_5,"Arial",总_ui_6);
ObjectSetText("Equity",StringConcatenate("淨值 ",DoubleToString(AccountEquity(),2)),总_in_5,"Arial",总_ui_6);
ObjectSetText("FreeMargin",StringConcatenate("可用保证金 ",DoubleToString(AccountFreeMargin(),2)),总_in_5,"Arial",总_ui_6);
子_do_33 = 子_do_4 + 子_do_3 ;
if ( 子_do_5>0.0 )
{
if ( 子_do_4>0.0 )
{
临_in_153 = 255;
}
else
{
临_in_153 = 65280;
}
ObjectSetText("ProfitB",StringConcatenate("Buy ",子_in_8,"单 , ",DoubleToString(子_do_5,2),"手, 盈亏= ",DoubleToString(子_do_4,2)),总_in_5,"Arial",临_in_153);
}
else
{
ObjectSetText("ProfitB","",总_in_5,"Arial",Gray);
}
if ( 子_do_6>0.0 )
{
if ( 子_do_3>0.0 )
{
临_in_154 = 255;
}
else
{
临_in_154 = 65280;
}
ObjectSetText("ProfitS",StringConcatenate("Sell ",子_in_9,"单 , ",DoubleToString(子_do_6,2),"手, 盈亏= ",DoubleToString(子_do_3,2)),总_in_5,"Arial",临_in_154);
}
else
{
ObjectSetText("ProfitS","",总_in_5,"Arial",Gray);
}
if ( 子_do_6 + 子_do_5>0.0 )
{
if ( 子_do_33>0.0 )
{
临_in_155 = 255;
}
else
{
临_in_155 = 65280;
}
ObjectSetText("Profit",StringConcatenate("总盈亏= ",DoubleToString(子_do_33,2)),总_in_5,"Arial",临_in_155);
}
else
{
ObjectSetText("Profit","",总_in_5,"Arial",White);
}
if ( 子_do_19!=0.0 && 总_bo_1 )
{
if ( 子_in_8 == 0 )
{
子_do_25 = NormalizeDouble(FirstStep * Point() + Ask,Digits()) ;
}
if ( 子_bo_34 && 子_in_8 > 0 )
{
子_do_25 = NormalizeDouble(MinDistance * Point() + Ask,Digits()) ;
}
if ( 子_bo_34 == false && 子_in_8 > 0 && Money!=0.0 )
{
子_do_25 = NormalizeDouble(TwoMinDistance * Point() + Ask,Digits()) ;
}
if ( NormalizeDouble(子_do_19 - StepTrallOrders * Point(),Digits())>子_do_25 && ( ( ( 子_do_25<=NormalizeDouble(子_do_16 - Step * Point(),Digits()) || 子_do_16==0.0 || ( 总_bo_11 && 子_in_8 == 0 ) || 子_do_25>=NormalizeDouble(Step * Point() + 子_do_15,Digits()) || 子_do_25<=NormalizeDouble(子_do_16 - Step * Point(),Digits()) ) && 子_bo_34 ) || (( 子_do_25<=NormalizeDouble(子_do_16 - TwoStep * Point(),Digits()) || 子_do_16==0.0 || ( 总_bo_11 && 子_in_8 == 0 ) || 子_do_25>=NormalizeDouble(TwoStep * Point() + 子_do_15,Digits()) || 子_do_25<=NormalizeDouble(子_do_16 - TwoStep * Point(),Digits()) ) && 子_bo_34 == false && Money!=0.0) ) )
{
if ( !(OrderModify(子_in_13,子_do_25,0.0,0.0,0,White)) )
{
Print("Error ",GetLastError()," Order Modify Buy OOP ",子_do_19,"->",子_do_25);
}
else
{
Print("Order Buy Modify OOP ",子_do_2,"->",子_do_25);
}}}
if ( 子_do_20!=0.0 && 总_bo_2 )
{
if ( 子_in_9 == 0 )
{
子_do_25 = NormalizeDouble(Bid - FirstStep * Point(),Digits()) ;
}
if ( 子_bo_34 && 子_in_9 > 0 )
{
子_do_25 = NormalizeDouble(Bid - MinDistance * Point(),Digits()) ;
}
if ( 子_bo_34 == false && 子_in_9 > 0 && Money!=0.0 )
{
子_do_25 = NormalizeDouble(Bid - TwoMinDistance * Point(),Digits()) ;
}
if ( NormalizeDouble(StepTrallOrders * Point() + 子_do_20,Digits())<子_do_25 && ( ( ( 子_do_25>=NormalizeDouble(Step * Point() + 子_do_17,Digits()) || 子_do_17==0.0 || ( 总_bo_12 && 子_in_9 == 0 ) || 子_do_25<=NormalizeDouble(子_do_18 - Step * Point(),Digits()) || 子_do_25>=NormalizeDouble(Step * Point() + 子_do_17,Digits()) ) && 子_bo_34 ) || (( 子_do_25>=NormalizeDouble(TwoStep * Point() + 子_do_17,Digits()) || 子_do_17==0.0 || ( 总_bo_12 && 子_in_9 == 0 ) || 子_do_25<=NormalizeDouble(子_do_18 - TwoStep * Point(),Digits()) || 子_do_25>=NormalizeDouble(TwoStep * Point() + 子_do_17,Digits()) ) && 子_bo_34 == false && Money!=0.0) ) )
{
if ( !(OrderModify(子_in_14,子_do_25,0.0,0.0,0,White)) )
{
Print("Error ",GetLastError()," Order Modify Sell OOP ",子_do_20,"->",子_do_25);
}
else
{
Print("Order Sell Modify OOP ",子_do_2,"->",子_do_25);
}}}
return(0);
}
//start
//--------------------- ----------------------------------------
void OnChartEvent (const int 木_0,const long &木_1,const double &木_2,const string &木_3)
{
int 子_in_1;
int 子_in_2;
int 子_in_3;
int 子_in_4;
int 子_in_5;
int 子_in_6;
int 子_in_7;
int 子_in_8;
int 子_in_9;
//----------------------------
string 临_st_1;
int 临_in_2;
int 临_in_3;
string 临_st_4;
int 临_in_5;
int 临_in_6;
string 临_st_7;
int 临_in_8;
int 临_in_9;
int 临_in_10;
string 临_st_11;
int 临_in_12;
int 临_in_13;
string 临_st_14;
string 临_st_15;
int 临_in_16;
double 临_do_17;
int 临_in_18;
double 临_do_19;
int 临_in_20;
string 临_st_21;
string 临_st_22;
int 临_in_23;
double 临_do_24;
int 临_in_25;
double 临_do_26;
string 临_st_27;
string 临_st_28;
int 临_in_29;
double 临_do_30;
int 临_in_31;
double 临_do_32;
int 临_in_33;
string 临_st_34;
string 临_st_35;
int 临_in_36;
double 临_do_37;
int 临_in_38;
double 临_do_39;
if ( 木_0 == 1 )
{
临_st_1 = "buy";
临_in_2 = 0;
for (临_in_3 = OrdersTotal() - 1 ; 临_in_3 >= 0 ; 临_in_3 = 临_in_3 - 1)
{
总_in_69 = OrderSelect(临_in_3,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_1 == "buy" && OrderType() == 0 )
{
临_in_2 = 临_in_2 + 1;
}
if ( 临_st_1 == "sell" && OrderType() == 1 )
{
临_in_2 = 临_in_2 + 1;
}
if ( 临_st_1 == "buystop" && OrderType() == 4 )
{
临_in_2 = 临_in_2 + 1;
}
if ( 临_st_1 != "sellstop" || OrderType() != 5 ) continue;
临_in_2 = 临_in_2 + 1;
}
if ( 临_in_2 > 0 )
{
子_in_1 = 0 ;
if ( 木_3 == "Button1" && 总_bo_34 == 1 )
{
子_in_2 = MessageBox("点击确定(Y)表示将全部平多单!是否继续?","友情提醒:",52) ;
if ( 子_in_2 == 6 )
{
for (子_in_3 = OrdersTotal() - 1 ; 子_in_3 >= 0 ; 子_in_3 = 子_in_3 - 1)
{
总_in_69 = OrderSelect(子_in_3,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( OrderType() == 0 )
{
子_in_1 = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),9),5,Red) ;
}
if ( OrderType() == 4 )
{
总_in_69 = OrderDelete(OrderTicket(),0xFFFFFFFF) ;
}
if ( 子_in_1 <= 0 ) continue;
PlaySound("ok.wav");
}
}}}}
if ( 木_0 == 1 )
{
临_st_4 = "sell";
临_in_5 = 0;
for (临_in_6 = OrdersTotal() - 1 ; 临_in_6 >= 0 ; 临_in_6 = 临_in_6 - 1)
{
总_in_69 = OrderSelect(临_in_6,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_4 == "buy" && OrderType() == 0 )
{
临_in_5 = 临_in_5 + 1;
}
if ( 临_st_4 == "sell" && OrderType() == 1 )
{
临_in_5 = 临_in_5 + 1;
}
if ( 临_st_4 == "buystop" && OrderType() == 4 )
{
临_in_5 = 临_in_5 + 1;
}
if ( 临_st_4 != "sellstop" || OrderType() != 5 ) continue;
临_in_5 = 临_in_5 + 1;
}
if ( 临_in_5 > 0 )
{
子_in_4 = 0 ;
if ( 木_3 == "Button2" && 总_bo_34 == 1 )
{
子_in_5 = MessageBox("点击确定(Y)表示将全部平空单!是否继续?","友情提醒:",52) ;
if ( 子_in_5 == 6 )
{
for (子_in_6 = OrdersTotal() - 1 ; 子_in_6 >= 0 ; 子_in_6 = 子_in_6 - 1)
{
总_in_69 = OrderSelect(子_in_6,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( OrderType() == 1 )
{
子_in_4 = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),10),5,Red) ;
}
if ( OrderType() == 5 )
{
总_in_69 = OrderDelete(OrderTicket(),0xFFFFFFFF) ;
}
if ( 子_in_4 <= 0 ) continue;
PlaySound("ok.wav");
}
}}}}
if ( 木_0 != 1 ) return;
临_st_7 = "buy";
临_in_8 = 0;
for (临_in_9 = OrdersTotal() - 1 ; 临_in_9 >= 0 ; 临_in_9 = 临_in_9 - 1)
{
总_in_69 = OrderSelect(临_in_9,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_7 == "buy" && OrderType() == 0 )
{
临_in_8 = 临_in_8 + 1;
}
if ( 临_st_7 == "sell" && OrderType() == 1 )
{
临_in_8 = 临_in_8 + 1;
}
if ( 临_st_7 == "buystop" && OrderType() == 4 )
{
临_in_8 = 临_in_8 + 1;
}
if ( 临_st_7 != "sellstop" || OrderType() != 5 ) continue;
临_in_8 = 临_in_8 + 1;
}
临_in_10 = 临_in_8;
临_st_11 = "sell";
临_in_12 = 0;
for (临_in_13 = OrdersTotal() - 1 ; 临_in_13 >= 0 ; 临_in_13 = 临_in_13 - 1)
{
总_in_69 = OrderSelect(临_in_13,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_11 == "buy" && OrderType() == 0 )
{
临_in_12 = 临_in_12 + 1;
}
if ( 临_st_11 == "sell" && OrderType() == 1 )
{
临_in_12 = 临_in_12 + 1;
}
if ( 临_st_11 == "buystop" && OrderType() == 4 )
{
临_in_12 = 临_in_12 + 1;
}
if ( 临_st_11 != "sellstop" || OrderType() != 5 ) continue;
临_in_12 = 临_in_12 + 1;
}
if ( 临_in_10 + 临_in_12 <= 0 ) return;
子_in_7 = 0 ;
if ( 木_3 != "Button5" || 总_bo_34 != 1 ) return;
子_in_8 = MessageBox("点击确定(Y)表示将全部平仓!是否继续?","友情提醒:",52) ;
if ( 子_in_8 != 6 ) return;
临_st_14 = "Ticket";
临_st_15 = "sell";
临_in_16 = 0;
临_do_17 = 0.0;
for (临_in_18 = OrdersTotal() - 1 ; 临_in_18 >= 0 ; 临_in_18 = 临_in_18 - 1)
{
if ( !(OrderSelect(临_in_18,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_15 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_16 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_17 = OrderLots();
临_in_16 = OrderTicket();
}
if ( 临_st_15 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_16 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_17 = OrderLots();
临_in_16 = OrderTicket();
}
if ( 临_st_14 == "Ticket" )
{
临_do_19 = 临_in_16;
}
else
{
if ( 临_st_14 == "Lots" )
{
临_do_19 = 临_do_17;
}
else
{
临_do_19 = 0.0;
}}
临_in_20 = 临_do_19;
临_st_21 = "Ticket";
临_st_22 = "buy";
临_in_23 = 0;
临_do_24 = 0.0;
for (临_in_25 = OrdersTotal() - 1 ; 临_in_25 >= 0 ; 临_in_25 = 临_in_25 - 1)
{
if ( !(OrderSelect(临_in_25,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_22 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_23 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_24 = OrderLots();
临_in_23 = OrderTicket();
}
if ( 临_st_22 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_23 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_24 = OrderLots();
临_in_23 = OrderTicket();
}
if ( 临_st_21 == "Ticket" )
{
临_do_26 = 临_in_23;
}
else
{
if ( 临_st_21 == "Lots" )
{
临_do_26 = 临_do_24;
}
else
{
临_do_26 = 0.0;
}}
if(OrderCloseBy(临_do_26,临_in_20,0xFFFFFFFF)){
do
{
临_st_27 = "Ticket";
临_st_28 = "sell";
临_in_29 = 0;
临_do_30 = 0.0;
for (临_in_31 = OrdersTotal() - 1 ; 临_in_31 >= 0 ; 临_in_31 = 临_in_31 - 1)
{
if ( !(OrderSelect(临_in_31,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_28 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_29 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_30 = OrderLots();
临_in_29 = OrderTicket();
}
if ( 临_st_28 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_29 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_30 = OrderLots();
临_in_29 = OrderTicket();
}
if ( 临_st_27 == "Ticket" )
{
临_do_32 = 临_in_29;
}
else
{
if ( 临_st_27 == "Lots" )
{
临_do_32 = 临_do_30;
}
else
{
临_do_32 = 0.0;
}}
临_in_33 = 临_do_32;
临_st_34 = "Ticket";
临_st_35 = "buy";
临_in_36 = 0;
临_do_37 = 0.0;
for (临_in_38 = OrdersTotal() - 1 ; 临_in_38 >= 0 ; 临_in_38 = 临_in_38 - 1)
{
if ( !(OrderSelect(临_in_38,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( 临_st_35 == "buy" && OrderType() == 0 && OrderTicket() > 临_in_36 )
{
OrderOpenTime();
OrderOpenPrice();
临_do_37 = OrderLots();
临_in_36 = OrderTicket();
}
if ( 临_st_35 != "sell" || OrderType() != 1 || OrderTicket() <= 临_in_36 ) continue;
OrderOpenTime();
OrderOpenPrice();
临_do_37 = OrderLots();
临_in_36 = OrderTicket();
}
if ( 临_st_34 == "Ticket" )
{
临_do_39 = 临_in_36;
}
else
{
if ( 临_st_34 == "Lots" )
{
临_do_39 = 临_do_37;
}
else
{
临_do_39 = 0.0;
}}
}
while(OrderCloseBy(临_do_39,临_in_33,0xFFFFFFFF));
}
for (子_in_9 = OrdersTotal() - 1 ; 子_in_9 >= 0 ; 子_in_9 = 子_in_9 - 1)
{
总_in_69 = OrderSelect(子_in_9,SELECT_BY_POS,MODE_TRADES) ;
if ( OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
if ( OrderType() == 0 )
{
子_in_7 = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),9),5,Red) ;
}
if ( OrderType() == 1 )
{
子_in_7 = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),10),5,Red) ;
}
if ( ( OrderType() == 4 || OrderType() == 5 ) )
{
总_in_69 = OrderDelete(OrderTicket(),0xFFFFFFFF) ;
}
if ( 子_in_7 <= 0 ) continue;
PlaySound("ok.wav");
}
}
//OnChartEvent
//--------------------- ----------------------------------------
int deinit ()
{
//----------------------------
ObjectDelete("HLINE_LONGII");
ObjectDelete("HLINE_SHORTII");
ObjectDelete("HLINE_LONG");
ObjectDelete("HLINE_SHORT");
ObjectsDeleteAll(0,-1);
return(0);
}
//deinit
//--------------------- ----------------------------------------
int lizong_7 (int 木_0)
{
int 子_in_1;
int 子_in_2;
int 子_in_3;
int 子_in_4;
bool 子_bo_5;
int 子_in_6;
//----------------------------
子_in_3 = 0 ;
子_in_4 = 0 ;
子_bo_5 = true ;
for ( ; ; )
{
for (子_in_6 = OrdersTotal() - 1 ; 子_in_6 >= 0 ; 子_in_6 = 子_in_6 - 1)
{
if ( !(OrderSelect(子_in_6,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
子_in_3 = OrderType() ;
if ( 子_in_3 == 0 && ( 木_0 == 1 || 木_0 == 0 ) )
{
子_bo_5 = OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits()),总_in_22,Blue) ;
if ( 子_bo_5 )
{
Comment("",OrderTicket(),"",OrderProfit()," ",TimeToString(TimeCurrent(),TIME_SECONDS));
}}
if ( 子_in_3 == 1 && ( 木_0 == -1 || 木_0 == 0 ) )
{
子_bo_5 = OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits()),总_in_22,Red) ;
if ( 子_bo_5 )
{
Comment("",OrderTicket(),"",OrderProfit()," ",TimeToString(TimeCurrent(),TIME_SECONDS));
}}
if ( 子_in_3 == 4 && ( 木_0 == 1 || 木_0 == 0 ) )
{
子_bo_5 = OrderDelete(OrderTicket(),0xFFFFFFFF) ;
}
if ( 子_in_3 == 5 && ( 木_0 == -1 || 木_0 == 0 ) )
{
子_bo_5 = OrderDelete(OrderTicket(),0xFFFFFFFF) ;
}
if ( 子_bo_5 ) continue;
子_in_1 = GetLastError() ;
if ( 子_in_1 < 2 ) continue;
if ( 子_in_1 == 129 )
{
Comment("",TimeToString(TimeCurrent(),TIME_SECONDS));
RefreshRates();
continue;
}
if ( 子_in_1 == 146 )
{
if ( !(IsTradeContextBusy()) ) continue;
Sleep(2000);
continue;
}
Comment("",子_in_1,"",OrderTicket()," ",TimeToString(TimeCurrent(),TIME_SECONDS));
}
子_in_4 = 0 ;
for (子_in_6 = 0 ; 子_in_6 < OrdersTotal() ; 子_in_6 = 子_in_6 + 1)
{
if ( !(OrderSelect(子_in_6,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || OrderMagicNumber() != Magic ) continue;
子_in_3 = OrderType() ;
if ( ( 子_in_3 == 4 || 子_in_3 == 0 ) && ( 木_0 == 1 || 木_0 == 0 ) )
{
子_in_4 = 子_in_4 + 1;
}
if ( ( 子_in_3 != 5 && 子_in_3 != 1 ) || ( 木_0 != -1 && 木_0 != 0 ) ) continue;
子_in_4 = 子_in_4 + 1;
}
if ( 子_in_4 == 0 ) break;
子_in_2 = 子_in_2 + 1;
if ( 子_in_2 > 10 )
{
Alert(Symbol(),"平仓超过10次",子_in_4);
return(0);
}
Sleep(1000);
RefreshRates();
continue;
}
return(1);
}
//lizong_7
//--------------------- ----------------------------------------
int lizong_8 (int 木_0)
{
//----------------------------
if ( 木_0 > 43200 )
{
return(0);
}
if ( 木_0 > 10080 )
{
return(43200);
}
if ( 木_0 > 1440 )
{
return(10080);
}
if ( 木_0 > 240 )
{
return(1440);
}
if ( 木_0 > 60 )
{
return(240);
}
if ( 木_0 > 30 )
{
return(60);
}
if ( 木_0 > 15 )
{
return(30);
}
if ( 木_0 > 5 )
{
return(15);
}
if ( 木_0 > 1 )
{
return(5);
}
if ( 木_0 == 1 )
{
return(1);
}
if ( 木_0 == 0 )
{
return(Period());
}
return(0);
}
//lizong_8
//--------------------- ----------------------------------------
void lizong_9 (int 木_0,int 木_1,int 木_2,int 木_3)//
{
//----------------------------
int 临_in_1;
int 临_in_2;
int 临_in_3;
double 临_do_4;
int 临_in_5;
while (木_2 > 0)
{
临_in_1 = 木_1;
临_in_2 = 木_0;
临_in_3 = -1;
临_do_4 = 0.0;
for (临_in_5 = OrdersTotal() - 1 ; 临_in_5 >= 0 ; 临_in_5 = 临_in_5 - 1)
{
if ( !(OrderSelect(临_in_5,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || ( OrderMagicNumber() != 临_in_1 && 临_in_1 != -1 ) || ( OrderType() != 临_in_2 && 临_in_2 != -100 ) ) continue;
if ( 木_3 == 1 && 临_do_4<OrderProfit() )//利润大于0的单子
{
临_do_4 = OrderProfit();
临_in_3 = OrderTicket();
}
if ( 木_3 != 2 || ( !(临_do_4>OrderProfit()) && !(临_do_4==0.0) ) ) continue;//利润小于0的单子
临_do_4 = OrderProfit();
临_in_3 = OrderTicket();
}
if ( OrderSelect(临_in_3,SELECT_BY_TICKET,MODE_TRADES) )
{
if ( 木_3 == 1 && OrderProfit()>=0.0 && OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0,0xFFFFFFFF) )
{
木_2 = 木_2 - 1;
}
if ( 木_3 == 1 && OrderProfit()<0.0 )
{
木_2 = 木_2 - 1;
}
if ( 木_3 == 2 && OrderProfit()<0.0 && OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0,0xFFFFFFFF) )
{
木_2 = 木_2 - 1;
}
if ( 木_3 == 2 && OrderProfit()>=0.0 )
{
木_2 = 木_2 - 1;
}}
else
{
木_2 = 木_2 - 1;
}
}
}
//lizong_9
//--------------------- ----------------------------------------
double lizong_10 (int 木_0,int 木_1,int 木_2,int 木_3)//计算总利润
{
double 子_x[100];
int 子_in_1;
int 子_in_2;
double 子_do_3;
//----------------------------
子_in_2 = 0 ;
子_do_3 = 0.0 ;
ArrayInitialize(子_x,0.0);
子_in_1 = 0 ;
for (子_in_2 = OrdersTotal() - 1 ; 子_in_2 >= 0 ; 子_in_2 = 子_in_2 - 1)
{
if ( !(OrderSelect(子_in_2,SELECT_BY_POS,MODE_TRADES)) || OrderSymbol() != Symbol() || ( OrderMagicNumber() != 木_1 && 木_1 != -1 ) || ( OrderType() != 木_0 && 木_0 != -100 ) ) continue;
if ( 木_2 == 1 && OrderProfit()>=0.0 )
{
子_x[子_in_1] = OrderProfit();
子_in_1 = 子_in_1 + 1;
}
if ( 木_2 != 2 || !(OrderProfit()<0.0) ) continue;
子_x[子_in_1] = -(OrderProfit());
子_in_1 = 子_in_1 + 1;
}
ArraySort(子_x,0,0,2);
子_do_3 = 0.0 ;
for (子_in_2 = 0 ; 子_in_2 < 木_3 ; 子_in_2 = 子_in_2 + 1)
{
子_do_3 = 子_do_3 + 子_x[子_in_2] ;
}
return(子_do_3);
}
//lizong_10
//--------------------- ----------------------------------------
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/hangyejiadao_581/mql4.git
git@gitee.com:hangyejiadao_581/mql4.git
hangyejiadao_581
mql4
mql4
master

搜索帮助