> 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.

# AddBar()

## Definition

Adds new data points for the Bars Type.

## Syntax

`AddBar(Bars bars, double open, double high, double low, double close, DateTime time, long volume)`

`AddBar(Bars bars, double open, double high, double low, double close, DateTime time, long volume, double bid, double ask)`

## Parameters

| bars   | The Bars object of your bars type               |
| ------ | ----------------------------------------------- |
| open   | A **double** value representing the open price  |
| high   | A **double** value representing the high price  |
| low    | A **double** value representing the low price   |
| close  | A **double** value representing the close price |
| time   | A **DateTime** value representing the time      |
| volume | A **long** value representing the volume        |
| bid    | A **double** value representing the bid price   |
| ask    | A **double** value representing the ask price   |

## Examples

```csharp
AddBar(bars, open, high, low, close, time, (long)Math.Min(volumeTmp, bars.BarsPeriod.Value));
```