OrderDelete() Error 4108 for Closing Pending Orders
- You don't close pending orders you delete them.
- Your initial loop counts pending and open orders as the same.
- It also assumes that the earliest two are for the current symbol/MN. Don't use the variable i, use OpenTrades.
Thanks for the feedback @William Roeder!
- In my description and in the code, I'm calling OrderDelete for the pending order.
- Understood. I can make that adjustment.
- Is there a way to loop through the orders and order by oldest orders to newest?
I have an EA running that has the potential to open a new pending order with each new candle that gets created. I'm now trying to delete the oldest pending order that was created so that each currency only has one pending order at a time. However, I'm getting error 4108 when calling OrderDelete() and not sure why. Can you look at this and see if there's any insight you can share?