Skip to content

CustomTimeFrameBarsNeededArgs.CustomBars

property · CustomTimeFrameBarsNeededArgs · cAlgo.API Since 5.3

DesktopCLICloud

Gets custom bars.

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

public CustomBars CustomBars {get;}
customTimeFrameBarsNeededArgs.CustomBars: CustomBars

Returns CustomBars

Examples

protected override void OnStart()
{
    TimeFrameManager.Custom.Add("My Custom TF").BarsNeeded = OnBarsNeeded;
}

private void OnBarsNeeded(CustomTimeFrameBarsNeededArgs args)
{
    var customBars = args.CustomBars;
    Print("Bars needed for {0}, loaded bars: {1}", customBars.Symbol.Name, customBars.Bars.Count);
}
from System import Action

def on_start(self):
    api.TimeFrameManager.Custom.Add("My Custom TF").BarsNeeded = Action[CustomTimeFrameBarsNeededArgs](self.on_bars_needed)

def on_bars_needed(self, args):
    customBars = args.CustomBars
    api.Print(f"Bars needed for {customBars.Symbol.Name}, loaded bars: {customBars.Bars.Count}")