/*[[ Name := Author := Link := Lots := 1.00 Stop Loss := 0 Take Profit := 250 Trailing Stop := 15 ]]*/ DEFINES: chart(60), OpentimeGMT(13),ClosetimeGMT(14),TimezoneBroker(3),yr(2004); var: i(0),SL(0),cnt(0),BuyStop(0),SellStop(0),orderentered(0); if year50*point then SL=50*point; if Stoploss>0 then SL=stoploss*point; If TotalTrades > 0 Then { for cnt = 1 to TotalTrades Begin If hour>(ClosetimeGMT+TimezoneBroker) and OrderValue(cnt,VAL_SYMBOL)=Symbol then { DeleteOrder(OrderValue(cnt,VAL_TICKET),RED); }; 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=(OpentimeGMT+TimezoneBroker) and minute<20 then{ if TotalTrades=0 then //no open trsdes in any currency { // if iatr(1,1)>19*Point then if ask>buystop-5*point then buystop=ask+5*point; SetOrder(OP_BUYSTOP,Lots,buystop,3,buystop-SL,buyStop+TakeProfit*Point,blue); orderentered=1; 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 { if bidSL Then { If Ord(i,VAL_STOPLOSS)<(Ask-TrailingStop*Point) Then { ModifyOrder(Ord(i,VAL_TICKET),Ord(i,VAL_OPENPRICE),Ask-TrailingStop*Point,Ord(i,VAL_TAKEPROFIT),White); Exit; }; }; }; If Ord(i,VAL_TYPE)=OP_SELL And OrderValue(i,VAL_SYMBOL)=Symbol Then { If (Ord(i,VAL_OPENPRICE)-Bid)>SL Then { If Ord(i,VAL_STOPLOSS)>(Bid+TrailingStop*Point) Then { ModifyOrder(Ord(i,VAL_TICKET),Ord(i,VAL_OPENPRICE),Bid+TrailingStop*Point,Ord(i,VAL_TAKEPROFIT),Gold); Exit; }; }; }; };