Try this:
//+------------------------------------------------------------------+ int ordersTotal = OrdersTotal(); //--- search in all open positions for (int i = ordersTotal - 1; i >= 0; i--) { //--- if an error occurs at selecting of this position then go to the next one... if (!OrderSelect(i, SELECT_BY_POS,MODE_TRADES)) continue; //--- if the position was opened not for the current symbol, skip it... if (OrderSymbol() != Symbol()) continue; if (Order_Type() == OP_BUY || Order_Type() == OP_SELL) continue; if(!OrderDelete(OrderTicket())) { Print("fail deleting pending order"); } } } //+------------------------------------------------------------------+
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
I want delete all orders pending only a symbol()
Thank you