Skip to content

TimeFrames

Summary

Represents collection of all time frames including custom time frames.

Signature

1
public abstract interface TimeFrames

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 using cAlgo.API;
 using System.Linq;
 namespace cAlgo.Robots;
 [Robot(AccessRights = AccessRights.None)]
 public class Test : Robot
 {
     protected override void OnStart()
     {
         Print($"TimeFrames Count: {TimeFrames.Count()}");
         foreach (var timeFrame in TimeFrames)
         {
             Print($"Name: {timeFrame.Name}, ShortName: {timeFrame.ShortName}");
         }
         TimeFrames.Added += args => Print($"TimeFrames added: {string.Join(", ", args.TimeFrames.Select(timeFrame => timeFrame.Name))}");
         TimeFrames.Removed += args => Print($"TimeFrames removed: {string.Join(", ", args.TimeFrames.Select(timeFrame => timeFrame.Name))}");
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 import clr
 clr.AddReference("cAlgo.API")
 from cAlgo.API import *
 class Test():
     def on_start(self):
         print(f"TimeFrames Count: {len(list(api.TimeFrames))}")
         for timeFrame in api.TimeFrames:
             print(f"Name: {timeFrame.Name}, ShortName: {timeFrame.ShortName}")
         api.TimeFrames.Added += lambda args: print(f"TimeFrames added: {", ".join([tf.Name for tf in args.TimeFrames])}")
         api.TimeFrames.Removed += lambda args: print(f"TimeFrames removed: {", ".join([tf.Name for tf in args.TimeFrames])}")

See Also

Events

Added

Summary

Occurs when new TimeFrames are added.

Signature

1
public abstract event Action<TimeFramesAddedEventArgs> Added;

Removed

Summary

Occurs when TimeFrames are removed.

Signature

1
public abstract event Action<TimeFramesRemovedEventArgs> Removed;