I want to do backtest from h1 time frame but it give me daily time frame

 

int Ema40Handle;
double Ema40[];

double Close[];
double Open[];
double High[];
double Low[];

double EntryPrice;
double SLPrice;
double TPPrice;
double LossRatio;
double ProfitRatio;

bool Bull1;
bool Bull2;
bool Bear1;
bool Bear2;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   if(CandleBelowMA40())
      Print("CandleBelowMA40()");
   else
      if(!CandleBelowMA40())
         Print("!CandleBelowMA40()");
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int a;
int i;
void CandleInfo()
  {
   for(i = 0; i < 10 ; i++)
     {
      ArrayResize(Close,10);
      ArrayResize(Open,10);
      ArrayResize(High,10);
      ArrayResize(Low,10);

      ArraySetAsSeries(Close,true);
      ArraySetAsSeries(Open,true);
      ArraySetAsSeries(High,true);
      ArraySetAsSeries(Low,true);

      Close[i] = iClose(_Symbol,PERIOD_CURRENT,i);
      Open[i] = iOpen(_Symbol,PERIOD_CURRENT,i);
      High[i] = iHigh(_Symbol,PERIOD_CURRENT,i);
      Low[i] = iLow(_Symbol,PERIOD_CURRENT,i);
     }
  }

void Ema40()
  {
   Ema40Handle = iMA(_Symbol,PERIOD_CURRENT,40,0,MODE_EMA,PRICE_CLOSE);
   ArraySetAsSeries(Ema40,true);
   CopyBuffer(Ema40Handle,0,1,10,Ema40);
  }

bool CandleBelowMA40()
  {
   CandleInfo();
   Ema40();
   for(i = ArraySize(Open)-1; i >= 0; i--)
     {
      if(Open[i]>Close[i])
         if(Open[i]>Ema40[i])
           {
            a = i;
            break;
           }
         else
            if(Close[i]>Open[i])
               if(Close[i]>Ema40[i])
                 {
                  a = i;
                  break;
                 }
     }
   if(Open[a]>Close[a])
     {
      if(Open[a]>Ema40[a])
        {
         Print("Open[a] = ",Open[a],"\n",
               "Ema40[a] = ",Ema40[a],"\n");
         return false;
        }
     }
   else
      if(Close[a]>Open[a])
        {
         if(Close[a]>Ema40[a])
           {
            Print("Close[a] = ",Close[a],"\n",
               "Ema40[a] = ",Ema40[a],"\n");
            return false; 
           }
        }
      else
         return true;
   return true;
  }

does anyone know why will this happened?

 
   Ema40Handle = iMA(_Symbol,PERIOD_CURRENT,40,0,MODE_EMA,PRICE_CLOSE);
   ArraySetAsSeries(Ema40,true);
   CopyBuffer(Ema40Handle,0,1,10,Ema40);

Perhaps you should read the manual, especially the examples.
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.

They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
          Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
          Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
          How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
          How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
          MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
          How to call indicators in MQL5 - MQL5 Articles (2010)

Reason: