Skip to content

FavoriteTimeFrames.Added

event · FavoriteTimeFrames · cAlgo.API Since 5.3

DesktopCLICloud

Occurs when new TimeFrames are added to favorite TimeFrames.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

event Action<FavoriteTimeFramesAddedEventArgs> Added;
favoriteTimeFrames.Added += handler  # handler(obj: FavoriteTimeFramesAddedEventArgs)

Examples

protected override void OnStart()
{
    TimeFrameManager.Favorite.Added += OnFavoriteTimeFramesAdded;
}

private void OnFavoriteTimeFramesAdded(FavoriteTimeFramesAddedEventArgs args)
{
    foreach (var timeFrame in args.TimeFrames)
        Print("Added to favorites: {0}", timeFrame.Name);
}
def on_start(self):
    api.TimeFrameManager.Favorite.Added += self.on_favorite_time_frames_added

def on_favorite_time_frames_added(self, args):
    for timeFrame in args.TimeFrames:
        api.Print(f"Added to favorites: {timeFrame.Name}")