CustomBars.AppendBar
method · CustomBars · cAlgo.API Since 5.3
DesktopCLICloud
Appends a new bar 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 AppendBar(CustomBar bar)
customBars.AppendBar(bar: CustomBar) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
bar | CustomBar | CustomBar | New bar |
Examples
var customBars = TimeFrameManager.Custom.Add("My Custom TF").AddBars(Symbols.GetSymbol("EURUSD"));
var openTime = customBars.Bars.Count > 0 ? customBars.Bars.LastBar.OpenTime.AddHours(1) : Server.Time.Date;
customBars.AppendBar(new CustomBar(openTime, 1.0850, 1.0870, 1.0840, 1.0865, 1200));
customBars = api.TimeFrameManager.Custom.Add("My Custom TF").AddBars(api.Symbols.GetSymbol("EURUSD"))
openTime = customBars.Bars.LastBar.OpenTime.AddHours(1) if customBars.Bars.Count > 0 else api.Server.Time.Date
customBars.AppendBar(CustomBar(openTime, 1.0850, 1.0870, 1.0840, 1.0865, 1200))