---
id: "T:cAlgo.API.CustomSymbolBarsNeededArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Symbol/Custom/CustomSymbolBarsNeededArgs/"
---

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

# CustomSymbolBarsNeededArgs (class)

Provides data for custom symbol BarsNeeded handler.

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.

## Definition

```csharp
public class CustomSymbolBarsNeededArgs
```

Available since cAlgo.API 5.3.

## Examples

C#:

```csharp
protected override void OnStart()
{
    var customSymbol = CustomSymbols.Add("MYEURUSD", Symbols.GetSymbol("EURUSD"));
    customSymbol.BarsNeeded = OnBarsNeeded;
}

private void OnBarsNeeded(CustomSymbolBarsNeededArgs args)
{
    var bars = MarketData.GetBars(args.CustomBars.TimeFrame, "EURUSD");
    args.CustomBars.AppendBars(bars.Select(bar => new CustomBar(bar.OpenTime, bar.Open, bar.High, bar.Low, bar.Close, (long)bar.TickVolume)));
    Print("Provided {0} bars for {1}", bars.Count, args.CustomSymbol.Name);
}
```

Python:

```python
from System import Action

def on_start(self):
    customSymbol = api.CustomSymbols.Add("MYEURUSD", api.Symbols.GetSymbol("EURUSD"))
    customSymbol.BarsNeeded = Action[CustomSymbolBarsNeededArgs](self.on_bars_needed)

def on_bars_needed(self, args):
    bars = api.MarketData.GetBars(args.CustomBars.TimeFrame, "EURUSD")
    for bar in bars:
        args.CustomBars.AppendBar(CustomBar(bar.OpenTime, bar.Open, bar.High, bar.Low, bar.Close, int(bar.TickVolume)))
    api.Print(f"Provided {bars.Count} bars for {args.CustomSymbol.Name}")
```

## Properties

- `public CustomBars CustomBars {get;}` — Gets custom bars. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Symbol/Custom/CustomSymbolBarsNeededArgs/CustomBars/index.md)
- `public CustomSymbol CustomSymbol {get;}` — Gets custom symbol. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Symbol/Custom/CustomSymbolBarsNeededArgs/CustomSymbol/index.md)

