Skip to content

CustomTimeFrame.GetBars

method · CustomTimeFrame · cAlgo.API Since 5.3

DesktopCLICloud

Returns bars of a symbol 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(Symbol symbol)
customTimeFrame.GetBars(symbol: Symbol) -> CustomBars

Parameters

Name C# type Python type Description
symbol Symbol Symbol Bars Symbol

Returns CustomBars — CustomBars

Examples

var customTimeFrame = TimeFrameManager.Custom.Add("My Custom TF");
var customBars = customTimeFrame.GetBars(Symbols.GetSymbol("EURUSD"));
if (customBars == null)
    Print("No custom bars added for EURUSD yet");
customTimeFrame = api.TimeFrameManager.Custom.Add("My Custom TF")
customBars = customTimeFrame.GetBars(api.Symbols.GetSymbol("EURUSD"))
if customBars is None:
    api.Print("No custom bars added for EURUSD yet")