Skip to content

TimeFrames

interface cAlgo.API Since 5.3

DesktopCLICloud

Represents collection of all time frames including custom time frames.

Environment behaviour

CLI — works differently. Lists only the standard built-in time frames, no custom ones. Added and Removed are never raised.

Cloud — works differently. Lists only the standard built-in time frames, no custom ones. Added and Removed are never raised.

Definition

public interface TimeFrames

Namespace: cAlgo.API · Group: Period

Examples

using cAlgo.API;
using System.Linq;

namespace cAlgo.Robots;

public partial 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))}");
    }
}
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("TimeFrames added: " + ", ".join([tf.Name for tf in args.TimeFrames]))
        api.TimeFrames.Removed += lambda args: print("TimeFrames removed: " + ", ".join([tf.Name for tf in args.TimeFrames]))
{
  "AccessRights": "None"
}

Events

Name Description
AddedDesktopCLICloudAction<TimeFramesAddedEventArgs> Occurs when new TimeFrames are added.
RemovedDesktopCLICloudAction<TimeFramesRemovedEventArgs> Occurs when TimeFrames are removed.

See also