Why is this a limitation in the tester?
Tester limitation, you can not get bar zero data (other timeframes/pairs)
My own testing doesn't indicate that this is true. We have disagreed about this before; https://www.mql5.com/en/forum/129856. As far as I know, an indicator which is called from an EA in backtesting can safely and successfully get values for higher timeframes. The MQL4 documentation at https://docs.mql4.com/series says "At the testing, price data of the same symbol but of another timeframe are modelled exactly, with the exception of volumes."
As far as I am aware, the issue lies with "MTF" indicators which are manually added to visual-mode backtesting - i.e. added by the user, not called by the EA being backtested. Such indicators sit half inside and half outside the backtesting sandbox. My understanding is that an indicator which is manually added to a chart in visual-mode backtesting sees the simulated values for the backtesting timeframe, but gets bar-end values on higher timeframes, not the simulated intra-bar values. Putting it crudely, if you manually add an "MTF" indicator to a visual-mode backtesting chart, then it can see into the future on higher timeframes.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm trying to get the current value for timeframe M15 on a M5 chart for MACD and the values I get for period [0] don't match what the MACD indicator shows me (using MTF MACD).
Code:
The MacdPrevious shows the correct value as it is the first completed bar [1], but the MacdCurrent does not match with what I'm getting from the indicator on the same M15 timeframe with the same settings. Can anyone explain why this is?
I've also tried iOsMA and had the same results.