/*[[ Name := simple parabolic SAR strategy Author := Copyright © 2003, Nick Bilak beluck[at]ukr.net Link := http://bilak.port5.com Notes := optimize 'step' and 'maximum' inputs!/////Smoky comment recommend for very short term charts. Lots := 1 Stop Loss := 30 Take Profit := 0 Trailing Stop := 0 ]]*/ Defines: step(0.01),maximum(0.2),slippage(5),risk(10),mm(0); var: h1(0),lotsi(0),i(0),x(0),y(0); x=Ask-StopLoss*Point;//initial stop y=Bid+StopLoss*Point;//initial stop If Bars<11 then Exit; If FreeMargin<100 then Exit; If((CurTime-LastTradeTime)<10) then Exit; //Print(iSAR(step,maximum,0),h[0],l[o]); if iSAR(step,maximum,1)-h[0] < 0 and iSAR(step,maximum,0)-h[0] > 0 then h1=-1; if iSAR(step,maximum,1)-l[0] > 0 and iSAR(step,maximum,0)-l[0] < 0 then h1=1; if mm<>0 then lotsi=Ceil(Equity*risk/10000)/10 else lotsi=lots; if h1>0 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,WHITE); }; If((CurTime-LastTradeTime)<10) then Exit; if TotalTrades<1 then { SetOrder(OP_BUY,lotsi,PriceAsk,Slippage,x,0,RED); }; }; if h1<0 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,WHITE); }; If((CurTime-LastTradeTime)<10) then Exit; if TotalTrades<1 then { SetOrder(OP_SELL,lotsi,Pricebid,Slippage,y,0,RED); }; };