I've got one custom indicator - USCPIMonthly
The code looks like this:
protected override void OnBarUpdate() { DateTime dtNow = Time[0]; int index = _helper.GetDateIndex(dtNow); if(index != null) { for(int i = 0; i < _helper.Series.Count; ++i) { Values[i].Set( _helper.Series[i].Values[index] ); } } }
Here I'm trying to reference it in another my indicator
protected override void OnBarUpdate() { if(USCPIMonthly().Count > 0) { double currCpi = USCPIMonthly()[0]; Print("USCPIMonthly()[0] = " + currCpi); double currCpiPrev = USCPIMonthly()[1]; // EXCEPTION HERE! Print("USCPIMonthly()[1] = " + currCpiPrev); Values[0].Set( (currCpi - currCpiPrev)/currCpiPrev * 100 ); } }
My question: why I cannot get the indicator value for the previous bar?
Comment