<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > ISeries<T> >


Previous page Return to chapter overview Next page


Returns the underlying input value at a specified bar index value.


Method Return Value

A double value representing the value at a specified bar.



GetValueAt(int barIndex)

ISeries<T>.GetValueAt(int barIndex)


Tip:  If called directly from the instance of the NinjaScript object, the value which is returned corresponds to the input series the object is running. (e.g., Close, High, Low, SMA, etc.).  If you're attempting to obtain another indicator value, you will need to pull this from the calculated indicator Value or Plot:


SMA(20).GetValueAt(123); // bar value
SMA(20).Values[0].GetValueAt(123); // indicator value

(Input as Indicator).Values[0].GetValueAt(123) // passed in indicator value




An int representing an absolute bar index value





protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
  // make sure there are bars displayed on the chart and the chart control is ready before running
  if (Bars == null || chartControl == null)
  // loop through all the visable bars on the chart
  for (int i = ChartBars.FromIndex - 1; i >= BarsRequiredToPlot; i--)
    double value = GetValueAt(i);
    Print(string.Format("The value at bar {0} is {1}", i, value));