Skip to content

Chart.LastVisibleBarIndex

property · Chart · cAlgo.API

DesktopCLICloud

Gets the index of the last visible bar on the chart.

Environment behaviour

Cloud — not supported. Always 0: the cloud host reports an empty viewport.

Definition

int LastVisibleBarIndex {get;}
api.Chart.LastVisibleBarIndex: int

Returns int

Examples

var lastIndex = Chart.LastVisibleBarIndex;
Print("Last visible bar: {0} closed at {1}", lastIndex, Bars.ClosePrices[lastIndex]);
lastIndex = api.Chart.LastVisibleBarIndex
api.Print(f"Last visible bar: {lastIndex} closed at {api.Bars.ClosePrices[lastIndex]}")