---
id: "T:cAlgo.API.BarsHistoryLoadedEventArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/EventArgs/BarsHistoryLoadedEventArgs/"
---

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

# BarsHistoryLoadedEventArgs (class)

Provides data for the history loaded event.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public class BarsHistoryLoadedEventArgs
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo.Robots
{
    // This sample indicator shows how to use BarsHistoryLoadedEventArgs
    public partial class BarsHistoryLoadedEventArgsSample : Robot
    {
        protected override void OnStart()
        {
            Bars.HistoryLoaded += Bars_HistoryLoaded;

            // You can load more bars by calling this method or LoadMoreHistory
            Bars.LoadMoreHistoryAsync();
        }

        // This method will be called if you scroll left on your chart and load more data
        // Or if you call the Bars.LoadMoreHistory/LoadMoreHistoryAsync methods
        // BarsHistoryLoadedEventArgs has two properties
        // BarsHistoryLoadedEventArgs.Bars refers to the bars object that it is history is loaded
        // BarsHistoryLoadedEventArgs.Count gives you the number of bars that has been loaded
        private void Bars_HistoryLoaded(BarsHistoryLoadedEventArgs obj)
        {
            Print("Loaded Bars Count: {0}", obj.Count);
        }
    }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        api.Bars.HistoryLoaded += self.on_bars_history_loaded
        # You can load more bars by calling this method or LoadMoreHistory
        api.Bars.LoadMoreHistoryAsync()

    def on_bars_history_loaded(self, args):
        print(f"Loaded Bars Count: {args.Count}")
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC"
}
```

## Properties

- `public Bars Bars {get;}` — Gets the bar objects data. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/BarsHistoryLoadedEventArgs/Bars/index.md)
- `public int Count {get;}` — Gets the number of bars. [details](https://help.ctrader.com/ctrader-algo/references/EventArgs/BarsHistoryLoadedEventArgs/Count/index.md)

