double HourDayStart = 6; //if brokertime not GMT then set the time to right timezone /* . . . . . */ //---- New Day datetime now = Time[0], bod = now - now % 86400; // Beginning of the day double HourDay = bod + HourDayStart * 3600; if(TimeCurrent()< HourDay)return(0);
Rodorush:
Hello everybody, I would like that my ea just start after 6am GMT (3am local time). How could I do this?
I did with the code below in init() function, but I guess that there are something easier.
Before posting please read some of the other threads . . . then you would have seen numerous requests like this one:
Please use this to post code . . . it makes it easier to read.deVries:
double HourDayStart = 6;
Hello everybody, thank you very much for all suggestions. All of them were very useful and I implemented a mix of solutions. All the best for you.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everybody, I would like that my ea just start after 6am GMT (3am local time). How could I do this?
I did with the code below in init() function, but I guess that there are something easier.
int init()
{
int secondsNow = TimeLocal();
for(int i=1;i<=86400;i++) if(TimeDay(secondsNow+i) == TimeDay(secondsNow)+1) break;
Sleep((i+3*3600)*1000);
/* We can check with this:
int rightTime = TimeLocal()+i+3*3600;
Alert(TimeDay(rightTime)+"/"+TimeMonth(rightTime)+"/"+TimeYear(rightTime)+" "+TimeHour(rightTime)+":"+TimeMinute(rightTime));
*/}