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

Back to topics list To post a new topic, please log in or register
avatar
5
bondstrader 2016.02.22 20:45
 

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. 

avatar
12995
WHRoeder 2016.02.23 02:18 #
 
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.

avatar
125
zirkoner 2016.02.27 19:38 #
 
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.
avatar
Moderator
3416
GumRai 2016.02.27 22:52 #
 
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

avatar
12995
WHRoeder 2016.02.28 03:55 #
 
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.
avatar
Moderator
3416
GumRai 2016.02.29 02:34 #
 
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.
Back to topics list  

To add comments, please log in or register