/*[[ Name := Eaverage open-close Author := Copyright © 2003, Nick Bilak, beluck[AT]ukr.net Link := http://bilak.port5.com Notes := Lots := 1 Stop Loss := 80 Take Profit := 800 Trailing Stop := 0 ]]*/ Defines: ol(10),cl(10),slippage(5),risk(10),mm(1),pp(0); var: histo1(0),histo2(0),bpr(0),spr(0),lepr(0),sepr(0),sl(0),ss(0),i(0),cnt(0),lotsi(0); If Bars<11 or TakeProfit<10 then Exit; // на графике менее 200 баров If FreeMargin<1000 then Exit; // денег нет - выходим //If((CurTime-LastTradeTime)<10) then Exit; if mm<>0 then lotsi=Ceil(Balance*risk/10000)/10 else lotsi=lots; histo1=iMAEx(cl,MODE_EMA,0,PRICE_CLOSE,0)-iMAEx(ol,MODE_EMA,2,PRICE_OPEN,0); if histo1>pp*point then { for i=1 to TotalTrades { if ord(i,VAL_TYPE)=OP_SELL then CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),bid,slippage,red) else if ord(i,VAL_TYPE)=OP_SELLSTOP then DeleteOrder(ord(i,VAL_TICKET),red); }; if TotalTrades<1 then { SetOrder(OP_BUY,lotsi,ask,Slippage,ask-StopLoss*point,ask+TakeProfit*Point,RED); }; }; if histo1<-pp*point then { for i=1 to TotalTrades { if ord(i,VAL_TYPE)=OP_BUY then CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),ask,slippage,red) else if ord(i,VAL_TYPE)=OP_BUYSTOP then DeleteOrder(ord(i,VAL_TICKET),red); }; if TotalTrades<1 then { SetOrder(OP_SELL,lotsi,bid,Slippage,bid+StopLoss*point,bid-TakeProfit*Point,RED); }; };