I'm trying to develop a script that will inspect the current values of several indicators plotted on a chart so that I can determine if they are converging or diverging.
Based on an example using ChartControl, I'm using the following code to print details of the indicators:
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
// Instantiate a ChartObjectCollection to hold chartControl.Indicators
ChartObjectCollection<NinjaTrader.Gui.NinjaScript. IndicatorRenderBase> indicatorCollection = chartControl.Indicators;
// Print the Calculate setting for any configured indicators not using Calculate.OnBarClose
foreach (NinjaTrader.Gui.NinjaScript.IndicatorRenderBase indicator in indicatorCollection)
{
if(indicator.Calculate != Calculate.OnBarClose)
Print(String.Format("{0} is using Calculate.{1}", indicator.Name, indicator.Calculate.ToString()));
if(indicator.Name != "IndiValue")
Print(String.Format("{0} current value is {1}", indicator.Name, indicator.GetValueAt(CurrentBar).ToString()));
}
}
Is it possible to retrieve each of the current indicator values?

Comment