Simple beginner problem - How to close an open order with OrderClose() ???
Is your ticket a static or global variable? Otherwise the ticket will be forgotten on the next tick (when the start function has been left and start is called again for a new tick).
Markus
i didnt even think of that, yes it is being forgotten on the next tick...
Thankyou Markus
You're welcome.
Good luck with your trading!
Markus
Good luck with your trading!
Markus
Basically i buy when a bar is higher than the previous high and close the position when the bar is lower than the previous low.
i can get the buy to work, but i cant close it and i keep getting this error : " invalid ticket for OrderClose function "
I dont understand what i am doing wrong.
Can someone please post some basic code on how you close an open position.
This is what i am using at the moment :
To Open:
and to Close (this is the problem) :