Skip to content

BarsHistoryLoadedEventArgs

class cAlgo.API

DesktopCLICloud

Provides data for the history loaded event.

Definition

public class BarsHistoryLoadedEventArgs

Namespace: cAlgo.API · Group: EventArgs

Examples

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);
        }
    }
}
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}")
{
  "AccessRights": "None",
  "TimeZone": "UTC"
}

Properties

Name Description
BarsDesktopCLICloudBars Gets the bar objects data.
CountDesktopCLICloudint Gets the number of bars.

See also