Quote:
|
Originally Posted by european
if init() executes only once when EA started then it is of no use if one wants an EA to resume working say in 10 minutes.
Unfortunately there is also a problem with OrderCloseTime() when a new tick happens immediately after an order was closed.
euro
|
Init() is only used to initialize the variables. This is intended to only be executed once.
To use this mechanism for shorter periods of restart time you could use the lower bartime like 15 or 30 minutes. e.g. iTime(NULL,PERIOD_M15,0)
For the OrderCloseTime() you are right; when just before the bar changes, the order is closed.
This depends however on how "next period" is defined.
If you want to restart at 24:00 just use the daily bar.
If you want to restart 24 hours after the last order was closed, then use 24 "hour-bars"
Cheers