CustomBars.UpdateLastBar
method · CustomBars · cAlgo.API Since 5.3
DesktopCLICloud
Updates the last bar.
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 UpdateLastBar(double open, double high, double low, double close, long volume)
customBars.UpdateLastBar(open: float, high: float, low: float, close: float, volume: int) -> None
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
open | double | float | Open price |
high | double | float | High price |
low | double | float | Low price |
close | double | float | Close price |
volume | long | int | Volume amount |
Examples
var customBars = TimeFrameManager.Custom.Add("My Custom TF").AddBars(Symbols.GetSymbol("EURUSD"));
if (customBars.Bars.Count > 0)
{
var lastBar = customBars.Bars.LastBar;
var price = customBars.Symbol.Bid;
customBars.UpdateLastBar(lastBar.Open, Math.Max(lastBar.High, price), Math.Min(lastBar.Low, price), price, (long)lastBar.TickVolume + 1);
}
customBars = api.TimeFrameManager.Custom.Add("My Custom TF").AddBars(api.Symbols.GetSymbol("EURUSD"))
if customBars.Bars.Count > 0:
lastBar = customBars.Bars.LastBar
price = customBars.Symbol.Bid
customBars.UpdateLastBar(lastBar.Open, max(lastBar.High, price), min(lastBar.Low, price), price, int(lastBar.TickVolume) + 1)