Deleting Pending Orders
batalhadematos:
Hi all,
int start() { if (... your code here ...) { DeletePendingOrders(Magic); } return(0); } int DeletePendingOrders(int Magic) { int total=OrdersTotal(); for (int cnt=total-1;cnt>=0;cnt--) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()!=OP_BUY || OrderType()!=OP_SELL)) { OrderDelete(OrderTicket()); } } return(0); }Cheers
Hi all,
I really need you help on detecting all pending orders with a specific "magic number" and delete them if a specific condition is found.
I have tried several ways but I was unable to do it. I am new to mql.
The idea is, if a condition is found (for instance a value for a variable is >= X), close all pending orders with THE magic number.
Thank you very very much
Regards
Paulo