MT4 visual mode using multiple timeframe data - page 2

 
Marcin Madrzak #:

Hello, I encountered a problem with accessing data from other TF than the one tested in Visual Mode. For example

or similar function (iOpen, iClose etc.) always returns data of M1 bar 0 from the moment of tester start - like access to other TF data is frozen and fixed to time of start. Data from M1 is downloaded and accessible in tester. I noticed, that if I recompile indicator running in tester time of the bar 0 changes to current time but it remains the same for the rest of the test.

I searched the forum but did not find the solution.

Thank you in advance for your help.

-- EDIT 2021.08.09 --

After further investigation up to date information from other TFs is available to EAs, but not to indicators. I am not able to find this information anywhere in the documentation.

Marcin

Hi Marcin,

Thanks for posting. I was having exactly the same problem. I still have it. I can't code EAs with any of my multi-timeframe indicators. Open, Close, High, Low and Time do not get updated in the tester.

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

   int start = 1;
   int limit;
   int counted_bars = IndicatorCounted();

   if(counted_bars < 0)
      return(-1);
       
   limit = Bars - 1 - counted_bars;
    
   for(int i = limit; i >= start; i--)   
   {
      int d_shift = iBarShift(Symbol(), PERIOD_D1, iTime(Symbol(), Period(), i), false);
      double pad = iOpen(Symbol(), PERIOD_D1, d_shift); // Read open price from a higher timeframe
      Print("OPEN PRICE FOR TODAY = "+ pad);      // THIS VALUE NEVER CHANGES DURING A BACKTEST IN A TIMEFRAME BELOW D1.
   }
}  


If anyone has a solution, I would appreciate it. Backtesting indicators that use data from more than one timeframe is necessary.

I understand that the data is available inside EAs, but not in indicators called via icustom?

Thanks.

 
Marcin Madrzak # - like access to other TF data is frozen and fixed to time of start.
What part of #3.2 was unclear?
Reason: