CustomSymbolBarsNeededArgs.CustomBars
property · CustomSymbolBarsNeededArgs · 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;}
customSymbolBarsNeededArgs.CustomBars: CustomBars
Returns CustomBars
Examples
protected override void OnStart()
{
CustomSymbols.Add("MYEURUSD", Symbols.GetSymbol("EURUSD")).BarsNeeded = OnBarsNeeded;
}
private void OnBarsNeeded(CustomSymbolBarsNeededArgs args)
{
Print("Bars needed for time frame {0}, loaded bars: {1}", args.CustomBars.TimeFrame, args.CustomBars.Bars.Count);
}
from System import Action
def on_start(self):
api.CustomSymbols.Add("MYEURUSD", api.Symbols.GetSymbol("EURUSD")).BarsNeeded = Action[CustomSymbolBarsNeededArgs](self.on_bars_needed)
def on_bars_needed(self, args):
api.Print(f"Bars needed for time frame {args.CustomBars.TimeFrame}, loaded bars: {args.CustomBars.Bars.Count}")