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
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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