Skip to content

BarsHistoryLoadedEventArgs

Summary

Provides data for the history loaded event.

Signature

1
public class BarsHistoryLoadedEventArgs

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 using cAlgo.API;
 namespace cAlgo.Robots
 {
     // This sample indicator shows how to use BarsHistoryLoadedEventArgs
     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public 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);
         }
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 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}")

See Also

Properties

Bars

Summary

Gets the bar objects data.

Signature

1
public Bars Bars {get;}

Return Value

Bars

Related Tutorials

Count

Summary

Gets the number of bars.

Signature

1
public int Count {get;}

Return Value

int