- Close one position open opposite position without hedge error
- Having a hard time getting my EA to close trades
- OrderClose Error 4051 - Invalid Ticket
jshumaker:
I am not getting an error message that the OrderSelect part failed, but I am getting OrderClose error 4051 - invalid ticket for OrderClose. I do not understand why.
You only get the message if the OrderSelect() fails AND OrdersTotal() == 1 what will happen if you have no orders ? the OrderSelect fails but OrdersTotal() = 0 so there is no message . . . . fix your code.
I am not getting an error message that the OrderSelect part failed, but I am getting OrderClose error 4051 - invalid ticket for OrderClose. I do not understand why.

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