Problem backtesting multi-timeframe EA

 

Good day to all,

I've coded an EA that checks the trend on daily timeframe using a 200 sma  and enters trades on H4. Trend checking logic contains the following code:

string CheckDailyTrend()
{
   // Moving average
   double DailyMA = iMA(Symbol(),PERIOD_D1,Daily_MAPeriod,0,MODE_SMA,PRICE_CLOSE,0);
   Print("SMA Daily: ",DailyMA);
   if(iOpen(Symbol(),PERIOD_D1,0)>DailyMA) 
      return ("UP");
   if(iOpen(Symbol(),PERIOD_D1,0)<DailyMA) 
      return ("DOWN");
   else 
      return ("");
}

Unfortunately, when backtesting on H4 in strategy test, with 14 years of data both of H4 and D1 timeframes, DailyMA is always 0. Why?

Reason: