Failed to copy data from the iIchimoku indicator, error code 4806

 

Hi, I want to use custom indicators in multi timeframe and multi symbols , but when I try to copy buffer  of a time frame other than current chart time frame it return error number 4806. 

the weird thing is that there is no error when I want to copy indicator's buffer from other symbols!

Any one know what I am doing wrong?

int handle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  { 
        ResetLastError();
        handle =  iIchimoku(Symbol(), PERIOD_H1,9,26,52);
        int  e =GetLastError();
        if(e!=0)
        Print("ichi Handle = ",handle,"  error = ",e);
  
   ArraySetAsSeries(ichiBuffer_tenkan_sen,true);
   
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
 {
        ZeroMemory(ichiBuffer_tenkan_sen);
        ResetLastError();
        if(CopyBuffer(ichiHandle,0,0,amount,ichiBuffer_tenkan_sen) <= 0)
                PrintFormat("1.Failed to copy data from the iIchimoku indicator, error code %d",GetLastError());
        return(rates_total);
}

--------------------------------------

Update:  there is no data founded even if I load that timeframe than switch to another time frame than run the indicator!

 if (BarsCalculated(handle) < 0)
{
        PrintFormat("Data not found (%d) >>", GetLastError());
        ChartSetSymbolPeriod(0, NULL, 0);
        return 0;
}

Log:
        Data not found (4806) >>
Reason: