How can I get my EA to recognize my manual actions?

 

Im logging trade times using OrderOpenTime() and OrderCloseTime(), which helps me keep track of my trades. However, at times, I need to manually close a trade that has been opened by my EA. But whenever I close a trade manually, the EA does not record the OrderCloseTime(). 

How can i get my EA to recognize my manual action, and print the OrderCloseTime() for such trades?

 Thanks. 

 
bondstrader: whenever I close a trade manually, the EA does not record the OrderCloseTime().
Your EA is broken; fix your EA. We can't see your code; there are no mindreaders here.
 
bondstrader:

Im logging trade times using OrderOpenTime() and OrderCloseTime(), which helps me keep track of my trades. However, at times, I need to manually close a trade that has been opened by my EA. But whenever I close a trade manually, the EA does not record the OrderCloseTime(). 

How can i get my EA to recognize my manual action, and print the OrderCloseTime() for such trades?

 Thanks. 

A manual trade has a magic number =0, include this processing in your EA.
 
bondstrader:

Im logging trade times using OrderOpenTime() and OrderCloseTime(), which helps me keep track of my trades. However, at times, I need to manually close a trade that has been opened by my EA. But whenever I close a trade manually, the EA does not record the OrderCloseTime(). 

How can i get my EA to recognize my manual action, and print the OrderCloseTime() for such trades?

 Thanks. 

As the EA opens trades, store the ticket numbers in an array

Loop through the array and check whether the order has been closed

If so, log the OrderOpenTime() and OrderCloseTime() and remove the order from the array

 
GumRai: As the EA opens trades, store the ticket numbers in an array
EA's must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV/file) of ticket numbers required.
 
GumRai:

As the EA opens trades, store the ticket numbers in an array


WHRoeder:
EA's must be coded to recover. If the power fails, OS crashes, terminal or chart is accidentally closed, on the next tick, any static/global ticket variables will have been lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a OrderSelect loop to recover, or persistent storage (GV/file) of ticket numbers required.
As Bondstrader is writing trade details to a log, I would think that he has some recovery code. So he would have to re-populate the array from the log in such an event.
Reason: