Quote:
|
Originally Posted by ryanklefas
Simple. And it could work. Then you could reset the boolean when a new day starts, at say:
Hour()==0 and Minute()==0.
|
Ryan, ticks do not always arrive at least once every minute. When that happens at 00:00, this would skip this EA to trade that day.
Perhaps it's batter to compare the daily bar timestamp: iTime(NULL,PERIOD_D1,0)
Lowphat's code would then be something like:
int init()
bool stoptrade=false;
datetime DailyBar=0;
if (stoptrade==false && DailyBar != iTime(NULL,PERIOD_D1,0))
{
if (logic)sell
if (logic)buy
stoptrade=true
DailyBar=iTime(NULL,PERIOD_D1,0);
}