/*[[ Name := mio trader Author := Copyright © 2006, Nick Bilak, beluck[AT]gmail.com Link := http://metatrader.50webs.com Notes := Lots := 1 Stop Loss := 20 Take Profit := 10 Trailing Stop := 0 ]]*/ Defines: slippage(0),risk(50),mm(1); var: i(0),cnt(0); var: lotsi(0),sell(false),buy(false),ptime(0),orders(0),sym(0); If FreeMargin<200 then Exit; If((CurTime-LastTradeTime)<30) then Exit; if mm<>0 then lotsi=Ceil(Balance*risk/10000)/10 else lotsi=lots; orders=0; sym=0; For i=1 to TotalTrades { If Ord(i,Val_Symbol)=Symbol then { sym=i; orders=1; }; }; sell=false; buy=false; if Close[1]>Open[1] then { buy=true; sell=false; } if Close[1]0 then { if ord(sym,VAL_TYPE)=OP_SELL then { CloseOrder(ord(sym,VAL_TICKET),ord(sym,VAL_LOTS),Bid,slippage,blue); exit; }; if ord(sym,VAL_TYPE)=OP_BUY then { CloseOrder(ord(sym,VAL_TICKET),ord(sym,VAL_LOTS),Ask,slippage,red); exit; }; }; if ptime<>time[0] and buy then { if orders==0 then { ptime=time[0]; SetOrder(OP_BUY,lotsi,Bid,Slippage,Bid-StopLoss*Point,Ask+TakeProfit*Point,RED); exit; }; }; if ptime<>time[0] and sell then { if orders==0 then { ptime=time[0]; SetOrder(OP_SELL,lotsi,Ask,Slippage,Ask+StopLoss*Point,Bid-TakeProfit*Point,blue); exit; }; };