OrderSend/OrderClose command

 

Hi there

 

When one uses the ordersend/orderclose command, I know that ordersend returns -1 if it fails, and some positive integer if it succeeds, we can store this in a variable called ticket.

when you use orderclose, that can return true or false to indicate whether the close command succeeded, but what happens with the ticket variable? does it just remain what it was last set to? and if it does, I assume that If I am going to use it in subsequent if else checks, I should reset it to something meaningless like zero?

 

thanks

Ian 

 
idh:

Hi there

 

When one uses the ordersend/orderclose command, I know that ordersend returns -1 if it fails, and some positive integer if it succeeds, we can store this in a variable called ticket.

when you use orderclose, that can return true or false to indicate whether the close command succeeded, but what happens with the ticket variable? does it just remain what it was last set to? and if it does, I assume that If I am going to use it in subsequent if else checks, I should reset it to something meaningless like zero? 

Why do you need to worry about the ticket variable ?  it will be overwritten when you do your next OrderSend() and if it's a local variable it will be re-initialised when the function that it is in is next called.
 

yeah I take your point raptor, I was using it as part of check to see if I had an open order (my EA only has one open order at a time).

Reason: