Want to delete pending orders of the particular symbol() alone(Where the EA is running)
But the code given down deletes all other pending orders.
Please give some idea to delete particular symbol's pending order alone.
why aren't you testing it's return value ? does your OrderDelete work ? why aren't you testing it's return value ? why do you keep ignoring good advice ?
This EA is just a helping tool. While compiling the other EA's, new orders are being placed. That's why I didn't check here.
Thank you. It works.
int start() { bool k; double cls; for(int i=0;i<OrdersTotal();i++) { k=OrderSelect(i,SELECT_BY_POS,MODE_TRADES); int Ticket=OrderTicket(); Print("Ticket = ", Ticket); if(Symbol() == OrderSymbol()) bool Ans=OrderDelete(Ticket); if(MathMod(OrderType(),2) == 0) double price = Bid; else if(MathMod(OrderType(),2) == 1) price = Ask; Ans = OrderClose(Ticket, OrderLots(), price, 3, NULL); Print("Order Type is : ", OrderType()); Print(GetLastError()); } ObjectsDeleteAll(); return(0); }This Code Closes and Deletes all orders of a particular Symbol.
No it doesn't.
You MUST count down, you have already been told . . . WHRoeder read this it explains why : https://forum.mql4.com/45482#567230
Why do you try to delete the order without having first checked what type of order it is ? When doing the OrderClose you can use OrderClosePrice() instead of checking if it is a Buy or Sell.
"Does your OrderSelect() work ? why aren't you testing it's return value ? does your OrderDelete work ? why aren't you testing it's return value ? why do you keep ignoring good advice ?"
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Want to delete pending orders of the particular symbol() alone(Where the EA is running)
But the code given down deletes all other pending orders.
Please give some idea to delete particular symbol's pending order alone.