Skip to content

CustomSymbol.GetBars

method · CustomSymbol · cAlgo.API Since 5.3

DesktopCLICloud

Returns bars of a time frame if exists otherwise null.

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

CustomBars GetBars(TimeFrame timeFrame)
customSymbol.GetBars(timeFrame: TimeFrame) -> CustomBars

Parameters

Name C# type Python type Description
timeFrame TimeFrame TimeFrame Bars TimeFrame, it must be a built-in time frame not custom.

Returns CustomBars — CustomBars

Examples

var customSymbol = CustomSymbols.Add("MYEURUSD", Symbols.GetSymbol("EURUSD"));
var customBars = customSymbol.GetBars(TimeFrame.Hour);
Print("Hourly custom bars exist: {0}", customBars != null);
customSymbol = api.CustomSymbols.Add("MYEURUSD", api.Symbols.GetSymbol("EURUSD"))
customBars = customSymbol.GetBars(TimeFrame.Hour)
api.Print(f"Hourly custom bars exist: {customBars is not None}")