I have a custom indicator that instantiate (or embed) a few other custom/system indicators
as follows:
protected override void OnStartUp()
{
Print("Inside OnStartUp");
_UpDown1 = RKMDCUpDown2(Color.Blue, Color.Red, MACDFast, MACDSlow, MACDSmooth);
_Stoch1 = RKMDCStoch(barsUsedInCalc, dColor, dWidth, kColor, kWidth, pctDSmooth, pctKSmooth);
_CCI1 = CCI(Typical, CCIPeriod);
_KRB1 = RKMKRB();
Print("Exiting OnStartUp");
}
I put some Print() statements in the OnBarUpdate() of the instantiated indicators and found that it is never called. The OnBarUpdate() is called in the top level indicator (the
instantiating indicator). Here is the code snippet for the OnBarUpdate() of the top level:
protected override void OnBarUpdate()
{
Print(" RKMEvalCTP OnBarUpdate Time: " + Time[0]);
if (CurrentBar < 53)
return;
EvalCond();
}
I see the print statement above is executed for 53 times and then I got the following error when trying to access a DataSeries in the lower level indicator:
Error on calling 'OnBarUpdate' method for indicator 'RKMEvalCTP' on bar 53: Object reference not set to an instance of an object.
temp = _UpDown1.IsLongZoneArr[1];
Thanks.
Comment