OrderSelect() returns a bool, not a ticket number . . so how is your OrderClose() going to work ?
Also, what happens if any of your OrderModify or OrderClose calls fail ? don't you want to know about it ? What are Function return values ? How do I use them ?
Also, perhaps you are closing the Order and then trying to modify it ? after the OrderClose() perhaps you should continue;
Of course, thanks. I got confused with OrderSend which returns the ticket number. Replacing "ticket" in this code with OrderTicket() solved the problem.
The EA is at an early stage, at the moment I'm just testing the logic of the trades. Once it's proved profitable on strategy tester I'll make it more robust in terms of checking for order execution failure.
Thanks again.
Best regards Steve
Of course, thanks. I got confused with OrderSend which returns the ticket number. Replacing "ticket" in this code with OrderTicket() solved the problem.
The EA is at an early stage, at the moment I'm just testing the logic of the trades. Once it's proved profitable on strategy tester I'll make it more robust in terms of checking for order execution failure.
There are many paths up the mountain.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm coding an EA that opens two limit orders at the same time but which then closes them using different logic. One of the orders ( the first in the logic ) is being handled fine. The second order is not being modified as per the logic I'm trying to apply to it and I'm getting the errors noted in the journal.
Here's the relevant code. Any suggestions gratefully received as to what I am doing wrong.