> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# GetValueAt()

## Definition

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

## Method Return Value

A double value representing the value at a specified bar.

## Syntax

**GetValueAt**(int barIndex)

**ISeries`\<t\>.GetValueAt`**(int barIndex)

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

## Parameters

| Parameter    | Description                                         |
| ------------ | --------------------------------------------------- |
| **barIndex** | An **int** representing an absolute bar index value |

## Examples

```csharp
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)
        return;       

    // loop through all the visible 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));       
    }
}
```