/*[[ Name := Author := Link := Lots := 1.00 Stop Loss := 34 Take Profit := 10 Trailing Stop := 15 ]]*/ DEFINES: chart(60); var: cnt(0),BuyStop(0),SellStop(0),orderentered(0); Buystop=high[1]+1*point; Sellstop=low[1]-1*point; If TotalTrades > 1 Then { for cnt = 1 to TotalTrades Begin If Ord(cnt,VAL_TYPE)=OP_BUYSTOP or Ord(cnt,VAL_TYPE)=OP_SELLSTOP then // this is a waiting order! { // check how long it exists in the trading terminal // time is counted in seconds: // 10 minutes = 600 seconds, 30 minutes = 1800, 1 hour = 3600, 1 day = 86400 If (CurTime-OrderValue(cnt,VAL_OPENTIME))>3600 then//1 hour { DeleteOrder(OrderValue(cnt,VAL_TICKET),RED); Exit; }; }; end; }; If OrderEntered=2 AND TotalTrades = 2 then{ If OrderValue(1,VAL_TYPE)=OP_BUY or OrderValue(1,VAL_TYPE)=OP_SELL then { DeleteOrder(OrderValue(2,VAL_TICKET),Red); exit; }; If OrderValue(2,VAL_TYPE)=OP_BUY or OrderValue(2,VAL_TYPE)=OP_SELL then { DeleteOrder(OrderValue(1,VAL_TICKET),Red); exit; }; }; if period != Chart then { Alert("This advisor only works on the ",chart," minute chart"); exit; }; if hour=16 and minute<1 then{ if TotalTrades=0 then //no open trsdes in any currency { // if iatr(1,1)>19*Point then orderentered=1; SetOrder(OP_BUYSTOP,Lots,buystop,3,sellstop-1*Point,buyStop+TakeProfit*Point,blue); exit; }; if TotalTrades=1 and OrderValue(1,VAL_SYMBOL) = Symbol) and OrderValue(1,val_type) = OP_BUYstop then //only one open trade is in this currency and it's a buy stop { orderentered=2; SetOrder(OP_SELLSTOP,Lots,sellStop,3,buystop+1*Point,sellStop-TakeProfit*Point,blue); exit; };};