Skip to content

Robot.OnBar

method · Robot · cAlgo.API

DesktopCLICloud

Called on each incoming Bar.

Definition

protected internal void OnBar()
api.OnBar() -> None

Examples

protected override void OnBar()
{
    Print("New bar opened at {0}, open price {1}", Bars.LastBar.OpenTime, Bars.LastBar.Open);
}
def on_bar(self):
    api.Print(f"New bar opened at {api.Bars.LastBar.OpenTime}, open price {api.Bars.LastBar.Open}")