You are right. What it happens is open the position, then the EA closes it but then the closed ticket causes the error.
Regards
Gonzalo
It sounds like you are passing an incorrect ticket number to the OrderModify and OrderClose functions. The ticket you reference must be pending or open - closed tickets will cause an error. Try printing the ticket number you are about to modify or close and check the result in the journal against your current orders.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
You are right. What it happens is open the position, then the EA closes it but then the closed ticket causes the error.
Regards
Gonzalo
HTH,
Aaron.