- 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?
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 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?