---
id: "M:cAlgo.API.BacktestingBarsData.#ctor(System.Collections.Generic.IEnumerable{cAlgo.API.BacktestingBar})"
kind: "constructor"
type: "T:cAlgo.API.BacktestingBarsData"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingBarsData/Constructor/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# BacktestingBarsData constructor

Member of [BacktestingBarsData](https://help.ctrader.com/ctrader-algo/references/Plugin/Backtesting/DataSource/BacktestingBarsData/index.md).

## BacktestingBarsData(IEnumerable<BacktestingBar> data)

Creates a new instance of BacktestingBarsData with passed data.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Available to plugins only, and plugins cannot run in the CLI.
- Cloud: Available to plugins only, and plugins cannot run in the cloud.

C#:

```csharp
public BacktestingBarsData(IEnumerable<BacktestingBar> data)
```

Python:

```python
BacktestingBarsData(data: Iterable[BacktestingBar])
```

### Parameters

- `data` (`IEnumerable<BacktestingBar>`, Python `Iterable[BacktestingBar]`): Bars data

Available since cAlgo.API 5.3.

### Examples

C#:

```csharp
var bars = new List<BacktestingBar>
{
    new BacktestingBar(new DateTime(2025, 1, 2, 0, 0, 0, DateTimeKind.Utc), 1.0350, 1.0365, 1.0342, 1.0360, 1200),
    new BacktestingBar(new DateTime(2025, 1, 2, 0, 1, 0, DateTimeKind.Utc), 1.0360, 1.0371, 1.0355, 1.0368, 950)
};
var barsData = new BacktestingBarsData(bars);
```

Python:

```python
from System import Array, DateTime, DateTimeKind
bars = [
    BacktestingBar(DateTime(2025, 1, 2, 0, 0, 0, DateTimeKind.Utc), 1.0350, 1.0365, 1.0342, 1.0360, 1200),
    BacktestingBar(DateTime(2025, 1, 2, 0, 1, 0, DateTimeKind.Utc), 1.0360, 1.0371, 1.0355, 1.0368, 950)
]
barsData = BacktestingBarsData(Array[BacktestingBar](bars))
```

