Skip to content

CustomSymbolNewChartEventArgs.CustomBars

property · CustomSymbolNewChartEventArgs · cAlgo.API Since 5.3

DesktopCLICloud

Gets custom bars for the newly opened custom symbol chart.

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;}
customSymbolNewChartEventArgs.CustomBars: CustomBars

Returns CustomBars

Examples

protected override void OnStart()
{
    var customSymbol = CustomSymbols.Add("EURUSD.custom", Symbols.GetSymbol("EURUSD"));
    customSymbol.NewChart += OnCustomSymbolNewChart;
}

private void OnCustomSymbolNewChart(CustomSymbolNewChartEventArgs args)
{
    if (args.CustomBars == null)
        return;
    args.CustomBars.AppendBar(new CustomBar(Server.Time, 1.1, 1.2, 1.0, 1.15, 100));
}
def on_start(self):
    customSymbol = api.CustomSymbols.Add("EURUSD.custom", api.Symbols.GetSymbol("EURUSD"))
    customSymbol.NewChart += self.on_custom_symbol_new_chart

def on_custom_symbol_new_chart(self, args):
    if args.CustomBars is None:
        return
    args.CustomBars.AppendBar(CustomBar(api.Server.Time, 1.1, 1.2, 1.0, 1.15, 100))