---
id: "E:cAlgo.API.CustomBars.NeedsMore"
kind: "event"
type: "T:cAlgo.API.CustomBars"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/TimeFrame/Custom/CustomBars/NeedsMore/"
---

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

# CustomBars.NeedsMore

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

## NeedsMore

Occurs when user scrolls back on a custom bars chart.

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
event Action<CustomBarsNeedsMoreEventArgs> NeedsMore;
```

Python:

```python
customBars.NeedsMore += handler  # handler(obj: CustomBarsNeedsMoreEventArgs)
```

### Returns

`Action<CustomBarsNeedsMoreEventArgs>` — 

Available since cAlgo.API 5.3.

### Examples

C#:

```csharp
private Bars _sourceBars;

protected override void OnStart()
{
    _sourceBars = MarketData.GetBars(TimeFrame.Hour, "EURUSD");
    var customBars = TimeFrameManager.Custom.Add("My Custom TF").AddBars(Symbols.GetSymbol("EURUSD"));
    customBars.NeedsMore += OnNeedsMore;
}

private void OnNeedsMore(CustomBarsNeedsMoreEventArgs args)
{
    var loadedCount = _sourceBars.LoadMoreHistory();
    args.CustomBars.PrependBars(_sourceBars.Take(loadedCount).Select(bar => new CustomBar(bar.OpenTime, bar.Open, bar.High, bar.Low, bar.Close, (long)bar.TickVolume)));
}
```

Python:

```python
from System import Array

def on_start(self):
    self.sourceBars = api.MarketData.GetBars(TimeFrame.Hour, "EURUSD")
    customBars = api.TimeFrameManager.Custom.Add("My Custom TF").AddBars(api.Symbols.GetSymbol("EURUSD"))
    customBars.NeedsMore += self.on_needs_more

def on_needs_more(self, args):
    loadedCount = self.sourceBars.LoadMoreHistory()
    olderBars = [CustomBar(self.sourceBars[i].OpenTime, self.sourceBars[i].Open, self.sourceBars[i].High, self.sourceBars[i].Low, self.sourceBars[i].Close, int(self.sourceBars[i].TickVolume)) for i in range(loadedCount)]
    args.CustomBars.PrependBars(Array[CustomBar](olderBars))
```

