Skip to content

BarsHistoryLoadedEventArgs.Bars

property · BarsHistoryLoadedEventArgs · cAlgo.API

DesktopCLICloud

Gets the bar objects data.

Definition

public Bars Bars {get;}
barsHistoryLoadedEventArgs.Bars: Bars

Returns Bars

Examples

protected override void OnStart()
{
    Bars.HistoryLoaded += OnBarsHistoryLoaded;
    Bars.LoadMoreHistoryAsync();
}

private void OnBarsHistoryLoaded(BarsHistoryLoadedEventArgs args)
{
    Print("{0} {1} now has {2} bars, first bar opened at {3}", args.Bars.SymbolName, args.Bars.TimeFrame, args.Bars.Count, args.Bars[0].OpenTime);
}
def on_start(self):
    api.Bars.HistoryLoaded += self.on_bars_history_loaded
    api.Bars.LoadMoreHistoryAsync()

def on_bars_history_loaded(self, args):
    api.Print(f"{args.Bars.SymbolName} {args.Bars.TimeFrame} now has {args.Bars.Count} bars, first bar opened at {args.Bars[0].OpenTime}")