Help Deleting Pending Order!!!
there is no OrderCloseTime()
regardless FindSell/Buy DeleteSell/Buy doesn't need to be a double it can be an int
Actually there is an OrderCloseTime().......it is equal to 0 for an open order(and a pending order).
Since your variables datetime t & s are also initialised to 0, the expression if(t<OrderCloseTime()) will always be false....ergo, CloseSell or CloseBuy will never be true and therefore your pending order will not delete.
double DeleteSell; for (DeleteSell = OrdersTotal()OrdersTotal is an int
int pendingTicket=0, openTicket=0; for (int pos = OrdersTotal()-1; pos >= 0; pos--) if( OrderSelect(DeleteSell, SELECT_BY_POS,MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber()== MagicNumberSell) if (OrderType > OP_SELL) pendingTicket = OrderTicket(); else openTicket = OrderTicket(); if (OpenTicket != 0 && pendingTicket != 0) OrderDelete(pendingTicket,Green);
Hi All, i have problem in deleting pending orders, my ea opens 2 pending orders one BuyStop and the other SellStop. When one is opened the other should be deleted. Please tell me what is wrong with my code: