Gabor Keresztessy:
Hi,
how can I code if I want a function of my EA is only executioning in a specified time. Example allways only in the 30th minutes of a hour.
Thanks for help.There are many ways to do it, but I would probably do something like this
void OnTick() { if(!ThirtyMinFunc()) Print("It's not time yet"); } //+------------------------------------------------------------------+ bool ThirtyMinFunc() { static datetime last_bar_time = iTime(_Symbol,PERIOD_M30,0); if(iTime(_Symbol,PERIOD_M30,0) == last_bar_time) return false; Print("There is a new 30 minute bar! Processing 30 min function"); last_bar_time = iTime(_Symbol,PERIOD_M30,0); /// do stuff return true; }
nicholishen:
Thanks for help, I'll try it soon.
There are many ways to do it, but I would probably do something like this
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
Hi,
how can I code if I want a function of my EA is only executioning in a specified time. Example allways only in the 30th minutes of a hour.
Thanks for help.