qq19342174:
Check it's https://docs.mql4.com/trading/OrderType it will no longer be a pending order if it's been executed/triggered.
Sometimes I need delete pending order,but if the pending order already executed,then MT4 will occur a 4108 error if I try to delete it.So I wonder is there a way to know a pending order already execute?
for(b=OrdersTotal()-1;b>=0;b--) { if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES)==true) { if (OrderType() == OP_BUYSTOP) OrderDelete(OrderTicket()); if (OrderType() == OP_SELLSTOP) OrderDelete(OrderTicket()); } }
Or simply . . .
if (OrderType() > OP_SELL)
APeng:
Thanks APeng,problem solved. And RaptorUK,thanks you too!

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
Sometimes I need delete pending order,but if the pending order already executed,then MT4 will occur a 4108 error if I try to delete it.So I wonder is there a way to know a pending order already execute?