I have a problem when my testing interval starts in Sunday. I used current time for starting point (marked in yellow). If the EA starts in Sunday I do not accept data. When the EA is already started - no problems.
Can somebody gave me a solution?
CopyBuffer(Handler, 0, TimeCurrent(), 100, Array)
...If the EA starts in Sunday I do not accept data. When the EA is already started - no problems...
bool first_tick_ever = true; // better be a global variable
bool Trades_allowed = true; // same recommendation
if(TickTime.day_of_week == 0) Trades_allowed = false;
first_tick_ever = false;
I make my own solution. This code must be putted in OnInit function.
datetime Time = TimeCurrent();
if(Time == TimeCurrent())
using infinite loops, and TimeCurrent() and Sleep() inside OnInit is not a good choice. your solution attempts all :)
Ahhhhaaaaaa, I understand. My solution work on backtest but in run mode will crash my EA if it is started in weekend. I simply add a check for mode and I believe now all is ok.
Thanks for explanation Code2219 or probably 2319!