Originally Posted by
;
Try to use the expiry date for pending orders:
Inserted Code total=OrdersTotal(); if (totallt;1) if (okToBuy) datetime expiry = Time#91;0#93; Period()*60; ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,PendingB O,3,Ask-StopLoss*Point, Ask TakeProfit*Point,My EA, 12345,expiration,Blue); I occasionally found it will not work if the time to expiration is to close, though. In that case you will need to manually check the pending order open time, for example like this:
Inserted Code if ((ticketgt;0) (totallt;=0)) if(OrderOpenTime() lt; Time#91;0#93;-RRB- OrderDelete(ticket,Green); I also wanted to mentionthat you should consider calling the indior with iCustom() rather than copy and pasting the code. However, it must not be simple and it is probably slower.