Here in the mqh file you have various time functions: https://www.mql5.com/en/code/45287
I think you find what you need like one week is from BoW(TimeCurrent()) until BoW(TimeCurrent()) + FXOneWeek ...

- www.mql5.com
if (M5){ Num_Bars = 1400*NumberWeekTest;} if (H1){ Num_Bars = 120*NumberWeekTest;}
That every bar every exists — they don't. What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
"Free-of-Holes" Charts - MQL4 Articles (2006)
No candle if open = close ? - MQL4 programming forum (2010)
Use iBarShift.
Here in the mqh file you have various time functions: https://www.mql5.com/en/code/45287
I think you find what you need like one week is from BoW(TimeCurrent()) until BoW(TimeCurrent()) + FXOneWeek ...
Thank you!
That every bar every exists — they don't. What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
"Free-of-Holes" Charts - MQL4 Articles (2006)
No candle if open = close ? - MQL4 programming forum (2010)
Use iBarShift.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, I am trying to test an EA where it starts each week and see the different results I get. Here is the code (removed all code not related to that matter), it works fine for the first 54 passes and stopped on 1 January 2023. Any idea why?
I set the input NumberWeekTest in the Fast genetic from 0 until 100, with steps of 1.
Thanks