iCustom strange behaviours

 

Hi everybody,


I'm building an indicator based on values from another indicator, named XYZ; I don't have source code for XYZ;

inside my indicator I call an object that encapsulate the call to iCustom as in the following code

        CIndicatorRCA myIndicator        = new CIndicatorRCA(indPath, indName, email, 
period ); // email and period are 2 on 16 parameters belonging to indicator XYZ; params from 3 to 16 have default value inside constructor in class CIndicatorRCA
											// also symbol and timeframe have default value (NULL and 0)
        // ...

        // For loop ...

        myIndicator.setTimeframe(tfPeriod);	//update timeframe for iCustom if needed

        arBuffer[arIndex]               = myIndicator.iCustom(4, i); // call iCustom with mode(4) and current bar shift (i)

There are 2 strange behaviours that I'm not able to address/understand:

1) When I drag my Indicator on chart, for all the bars in the past I get EMPTY_VALUE while for new bars  I get correct values

2) If I close MT4 (with chart and my Indicator as described in 1) and reOpen it, I got the the correct values for the bars in the past while for new bars  I get EMPTY_VALUE;

then if I update parameters of My Indicator, behaviour return as in 1


What going on? Any idea?

Thanks in advance

Danilo