extern bool auto=true; extern double lots=0.1, stop=0.75; extern int mgod=2005, start=1, depth=12, deviation=5, backstep=3, TP=150, SL=30, SL2=1, ttime=15, eaID=735345; int del; del = MarketInfo(Symbol(),MODE_STOPLEVEL); int i, cnt, LTT, j, s,b, os,ob, mods, top, dblok; double MaxH, MinL, MidL, mtp, MH,LH, mlot, MidLine, summa, ssum, bsum, slot, blot, kr, kz, zz, zz0, TSumm[10000], MaxS; string reg; // EXPERT RUN --------------------------------------------------------------- int start() { Initialize(); RangeCalculation(); Order_inventory(); DataDisplay(); SecureProfit(); Order_modify(); Order_close(); Order_delete(); Order_place(); } // FUNCTION DUMP ------------------------------------------------------------ void Initialize() { // Main switches if (start==0) return; if (Year()!=mgod) return; // Money management & sizing if (lots>=1 && AccountBalance()>=10000) kr=NormalizeDouble((AccountBalance()/10000),0); if (lots<1 && AccountBalance()<10000) kr=1; if (lots<1 && AccountBalance()>=1000) kr=NormalizeDouble((AccountBalance()/1000),0); if (lots<1 && AccountBalance()<1000) kr=1; if (kr>100) kr=100; mlot=kr*lots; j++; if (Minute()==0) j=0; if (auto==1) reg="Auto"; if (auto==0) reg="Manual"; } void RangeCalculation() { if (((High[0]-Low[0])/Point)>=10 && Hour()==23 && Minute()>55) { MaxH=High[0]; MinL=Low[0]; } else { MaxH=High[1]; MinL=Low[1]; } MidL=NormalizeDouble((MaxH+MinL)/2,Digits); mtp=(MaxH-MinL)/2; zz = iCustom(Symbol(),0,"ZigZag",depth,deviation,backstep,0,3); zz0 = iCustom(Symbol(),0,"ZigZag",depth,deviation,backstep,0,0); if (zz!=0 && zz>Close[0] && Hour()==23 && Minute()>=55) top=1; if (zz!=0 && zz=55) top=-1; if (zz0>0) top=0; if (ObjectFind("MaxH")<0) ObjectCreate("MaxH",OBJ_HLINE,0,Time[0],MaxH); ObjectSet("MaxH",OBJPROP_PRICE1,MaxH); ObjectSet("MaxH",OBJPROP_COLOR,GreenYellow); if (ObjectFind("MinL")<0) ObjectCreate("MinL",OBJ_HLINE,0,Time[0],MinL); ObjectSet("MinL",OBJPROP_PRICE1,MinL); ObjectSet("MinL",OBJPROP_COLOR,Red); } //----------------------------------------Подсчёт активных и пассивных ордеров---------------------------------------- void Order_inventory() { s=0; b=0; os=0; ob=0; summa=0; slot=0; blot=0; ssum=0; bsum=0; for (int cnt=0; cnt