You need to loop through the order pool and select the order first...
https://book.mql4.com/trading/orderclose
https://docs.mql4.com/trading/OrderSelect
Also not, that in the book the for loop increments i looping through the orders. If you are closing, you need to count backwards...there are explanations on the site... I don't have a link handy...
V

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
Hello,
I am trying to achieve my first EA. The strategy is this: buy when the Moving Average 18 is under the MA9 and close when it is the contrary.
I can't find why the closing orders don't work...
I need your help! Thanks!