Time constraint

To add comments, please log in or register
apleasewouldbenice boom
59
apleasewouldbenice boom  
How can I make sure that;

Advisor (robot)should open position only if 5 min passed after last position had opened.

Thanks.
andrew
405
andrew  
apleasewouldbenice boom:
How can I make sure that;

Advisor (robot)should open position only if 5 min passed after last position had opened.

Thanks.
Look into using the OnTimer() event? Maybe set it to run 300 sec (5 min) after the last trade 
apleasewouldbenice boom
59
apleasewouldbenice boom  
andrew4789:
Look into using the OnTimer() event? Maybe set it to run 300 sec (5 min) after the last trade 
Good idea :) Can you explain more please ?
Thanks for your help 
nicholi shen
2392
nicholi shen  
You need to be able to recover after your EA crashes. In order to know the last trade you need to iterate over the history and store the highest order open time in a static variable. Check if the time in this variable is less that five minutes from now. Return false if yes else iterate the pool again and return true if there are no new trades.
To add comments, please log in or register