Skip to content

CustomBars.AppendBars

method · CustomBars · cAlgo.API Since 5.3

DesktopCLICloud

Appends a collection of bars to the end of bars collection.

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

void AppendBars(IEnumerable<CustomBar> bars)
customBars.AppendBars(bars: Iterable[CustomBar]) -> None

Parameters

Name C# type Python type Description
bars IEnumerable<CustomBar> Iterable[CustomBar] New bars

Examples

var customBars = TimeFrameManager.Custom.Add("My Custom TF").AddBars(Symbols.GetSymbol("EURUSD"));
var sourceBars = MarketData.GetBars(TimeFrame.Hour4, "EURUSD");
customBars.AppendBars(sourceBars.Select(bar => new CustomBar(bar.OpenTime, bar.Open, bar.High, bar.Low, bar.Close, (long)bar.TickVolume)));
from System import Array
customBars = api.TimeFrameManager.Custom.Add("My Custom TF").AddBars(api.Symbols.GetSymbol("EURUSD"))
sourceBars = api.MarketData.GetBars(TimeFrame.Hour4, "EURUSD")
newBars = [CustomBar(bar.OpenTime, bar.Open, bar.High, bar.Low, bar.Close, int(bar.TickVolume)) for bar in sourceBars]
customBars.AppendBars(Array[CustomBar](newBars))