Problema para obtener buffer de indicador en distintos timeframe

 

Tengo un problema para obtener búferes de datos usando la función iCustom

Mi indicador usa otro indicador iCustom en 2 períodos de tiempo diferentes:

- primer indicador: iCustom en PERIOD_CURRENT,

- segundo:  en el período diario.


No tengo problemas para obtener el identificador del indicador, pero cuando trato de obtener el búfer en OnCaculate (), usando CopyBuffer, no puedo obtener datos para el identificador de mi indicador con un período diario (los datos copiados son -1).

A continuación puede ver mi código.

NOTA: Este problema no ocurre, si trato de cargar el indicador en un EA. 

 OnInit()
{
/*................*/

    if((indReg =iCustom(NULL,PERIOD_CURRENT,"REGRES.ex5", nBar))==INVALID_HANDLE))
        {
         printf("Error creating ICUSTOM-REGRES indicator");
         return(false);
        }
      if((indRegDay =iCustom(NULL,PERIOD_D1,"REGRES.ex5", 5))
        {
         printf("Error creating ICUSTOM-REG-DAY indicator");
         return(false);
        }
/*******..........................*********/
}

 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[])   
{      
        Copied= CopyBuffer(indReg,0,0,rates_total,BReg);  
        Copied= CopyBuffer(indRegDay,0,0,rates_total,BRegDay);


 /*************...............................*******************/ 
}


¿Alguien puede ayudarme a resolver mi problema?

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  Custom indicator name. If the name starts with the reverse slash '\', the EX5 indicator file is searched for relative to the MQL5\Indicators indicator root directory. Thus, when calling FirstIndicator"...), the indicator is downloaded as MQL5\Indicators\FirstIndicator.ex5. If the path contains no file, the error 4802...
Razón de la queja: