---
id: "P:cAlgo.API.CustomTimeFrameBarsNeededArgs.CustomBars"
kind: "property"
type: "T:cAlgo.API.CustomTimeFrameBarsNeededArgs"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/TimeFrame/Custom/CustomTimeFrameBarsNeededArgs/CustomBars/"
---

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

# CustomTimeFrameBarsNeededArgs.CustomBars

Member of [CustomTimeFrameBarsNeededArgs](https://help.ctrader.com/ctrader-algo/references/Plugin/TimeFrame/Custom/CustomTimeFrameBarsNeededArgs/index.md).

## CustomBars

Gets custom bars.

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 CustomBars CustomBars {get;}
```

Python:

```python
customTimeFrameBarsNeededArgs.CustomBars: CustomBars
```

### Returns

`CustomBars` — 

Available since cAlgo.API 5.3.

### Examples

C#:

```csharp
protected override void OnStart()
{
    TimeFrameManager.Custom.Add("My Custom TF").BarsNeeded = OnBarsNeeded;
}

private void OnBarsNeeded(CustomTimeFrameBarsNeededArgs args)
{
    var customBars = args.CustomBars;
    Print("Bars needed for {0}, loaded bars: {1}", customBars.Symbol.Name, customBars.Bars.Count);
}
```

Python:

```python
from System import Action

def on_start(self):
    api.TimeFrameManager.Custom.Add("My Custom TF").BarsNeeded = Action[CustomTimeFrameBarsNeededArgs](self.on_bars_needed)

def on_bars_needed(self, args):
    customBars = args.CustomBars
    api.Print(f"Bars needed for {customBars.Symbol.Name}, loaded bars: {customBars.Bars.Count}")
```

