What bar does Bars.ClosePrices.Last(0) return in OnBarClosed()?
Created at 27 Feb 2024, 08:42
What bar does Bars.ClosePrices.Last(0) return in OnBarClosed()?
27 Feb 2024, 08:42
In the docs it says that
“When accessed in this event handler, the Bars
collection does not contain the current live bar, whereas other collections (e.g., Positions
, Symbols
, etc.) contain actual data.”
Does this mean that
Bars.ClosePrices.Last(0)
inside the OnBarClosed() event handler returns the previous bar's close price (whereas Last(0) would typically return the current one)?
PanagiotisCharalampous
27 Feb 2024, 09:44
Hi there,
In OnBarClosed() Bars.ClosePrices.Last(0) represents the bar that has closed.
Best regards,
Panagiotis
@PanagiotisCharalampous