---
id: "M:cAlgo.API.CustomSymbol.GetBars(cAlgo.API.TimeFrame)"
kind: "method"
type: "T:cAlgo.API.CustomSymbol"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Symbol/Custom/CustomSymbol/GetBars/"
---

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

# CustomSymbol.GetBars

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

## GetBars(TimeFrame timeFrame)

Returns bars of a time frame if exists otherwise null.

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
CustomBars GetBars(TimeFrame timeFrame)
```

Python:

```python
customSymbol.GetBars(timeFrame: TimeFrame) -> CustomBars
```

### Parameters

- `timeFrame` (`TimeFrame`, Python `TimeFrame`): Bars TimeFrame, it must be a built-in time frame not custom.

### Returns

`CustomBars` — CustomBars

Available since cAlgo.API 5.3.

### Examples

C#:

```csharp
var customSymbol = CustomSymbols.Add("MYEURUSD", Symbols.GetSymbol("EURUSD"));
var customBars = customSymbol.GetBars(TimeFrame.Hour);
Print("Hourly custom bars exist: {0}", customBars != null);
```

Python:

```python
customSymbol = api.CustomSymbols.Add("MYEURUSD", api.Symbols.GetSymbol("EURUSD"))
customBars = customSymbol.GetBars(TimeFrame.Hour)
api.Print(f"Hourly custom bars exist: {customBars is not None}")
```

