Skip to content

CustomSymbol.NewChart

event · CustomSymbol · cAlgo.API Since 5.3

DesktopCLICloud

Occurs when user opens a new chart of current custom symbol.

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<CustomSymbolNewChartEventArgs> NewChart;
customSymbol.NewChart += handler  # handler(obj: CustomSymbolNewChartEventArgs)

Examples

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

private void OnCustomSymbolNewChart(CustomSymbolNewChartEventArgs args)
{
    Print("New {0} chart opened on {1}", args.CustomSymbol.Name, args.CustomBars.TimeFrame);
}
def on_start(self):
    customSymbol = api.CustomSymbols.Add("MYEURUSD", api.Symbols.GetSymbol("EURUSD"))
    customSymbol.NewChart += self.on_custom_symbol_new_chart

def on_custom_symbol_new_chart(self, args):
    api.Print(f"New {args.CustomSymbol.Name} chart opened on {args.CustomBars.TimeFrame}")