I modified Chelsea_B's Example code for attaching to an indicator and have run into an issue I don't understand.
Surprisingly this runs in ONRender which is unusual but works for the purpose I need _ if I try to run it in ONBarUpdate I get
different values as the indicator calculates.OnBarClose but this code runs onEachTick.
double Displace = TickSize * Offset;
if ( Direction > 0)
{
//if(indicator.Values[0].IsValidDataPoint(index))// prevents values updating
IndieValue = Instrument.MasterInstrument.RoundDownToTickSize(indicator.Values[0].GetValueAt(index));
UsedValue = IndieValue - Displace;
}
If I include the check for data validity the code no longer works but doesn't fail or give any errors.
It seems good practice to check if in fact there is a valid data point but I can't work out why it would fail?
Any help or advice appreciated.

Comment