/*[[ Name := ROBOTIC2 Author := Copyright © 2005, MetaQuotes Software Corp. Link := http://www.metaquotes.net/ Lots := 1.00 Stop Loss := 30 Take Profit := 30 Trailing Stop := 999 ]]*/ var: TrailStop(0); var: Stop(0); var: Ordre(0); var: H1(0); var: H0(0); var: L1(0); var: L0(0); var: Pip(1); var: cnt(0); If Bars<100 or TakeProfit<10 then Exit; If IsIndirect(Symbol)=TRUE then Exit; TrailStop=1.0*iATR(3,1); H1=High[1]; L1=Low[1]; H0=High[0]; L0=Low[0]; If CurTime-LastTradeTime>300 and TotalTrades<1 then { Stop=H1+1*Point-(H1-L1)*0.6-6*Point; If (H1-Stop>StopLoss*Point) then (Stop=Ask-StopLoss*Point); If (Open[1]H1 and iSAR(0.02,0.2,0)StopLoss*Point) then (Stop=Bid+StopLoss*Point); If (Open[1]>Close[1]|Open[1]-Close[1]Bid then {SetOrder(OP_SELLSTOP,Lots,L1-6*Point,0,Stop,L1-1*Point-(H1-L1),Red); Exit;}; }; If TrailingStop<5 then {print("Trailing Stop INVALIDE");Exit;}; for cnt=1 to TotalTrades { Ordre=OrderValue(cnt,VAL_TYPE); If Ordre=OP_BUY then { If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(TrailStop) then { If OrderValue(cnt,VAL_STOPLOSS)<(Bid-TrailStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),Bid-TrailStop,OrderValue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If Ordre=OP_SELL then { If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(TrailStop) then { If OrderValue(cnt,VAL_STOPLOSS)>(Ask+TrailStop) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),Ask+TrailStop,OrderValue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If Ordre>OP_SELL then { If (Minute>58) then { DeleteOrder(OrderValue(cnt,VAL_TICKET),RED); Exit; }; }; If Ordre>OP_BUY then { If (Minute>58) then { DeleteOrder(OrderValue(cnt,VAL_TICKET),RED); Exit; }; }; };