Thanks so much guys, that seems to do it!
Still learning MQL4, always great to see when the language has another thing already prepared!
ZetaTrader:
The iTime etc. variants work fine!
However, when switching to another timeframe, the processing takes a multiple times longer than in the original M1 timeframe, even though there are no additional tasks.
@Carl I will have a look at MqlRates to learn about it, thanks a lot
The first call to iTime, iLow etc takes significantly more time than accessing the current period Time array. Then subsequent calls in the same tick processing cycle can be quicker
Another option to save cycles is to use CopyTime and get multiple bars at once
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
My indicator is supposed to draw lines from and to bars in the M1 timeframe, which it does fine using the Time[] arrays etc.
However, I'd like to view the same lines when switching to a higher timeframe, say, M5.
Instead, my indicator will deinit and init again, when switching timeframes, redrawing lines based on the M5 arrays.
Is there a way to let the code always refer to the values of the Time[] array for the M1 candles, even when switching to a higher timeframe.
Thanks a lot for your help!