Skip to content

BarsTickEventArgs.IsBarOpened

property · BarsTickEventArgs · cAlgo.API

DesktopCLICloud

Defines if current tick is the first tick of a new bar.

Definition

public bool IsBarOpened {get;}
barsTickEventArgs.IsBarOpened: bool

Returns bool

Examples

protected override void OnStart()
{
    Bars.Tick += OnBarsTick;
}

private void OnBarsTick(BarsTickEventArgs args)
{
    if (args.IsBarOpened)
        Print("New bar opened at {0}", args.Bars.LastBar.OpenTime);
}
def on_start(self):
    api.Bars.Tick += self.on_bars_tick

def on_bars_tick(self, args):
    if args.IsBarOpened:
        api.Print(f"New bar opened at {args.Bars.LastBar.OpenTime}")