GetClose()

View as Markdown

Definition

Returns the closing price at the current bar index value.

Method Return Value

A double value that represents the close price at the desired bar index.

Syntax

Bars.GetClose(int index)

Parameters

ParameterDescription
indexAn int representing an absolute bar index value

Examples

1protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
2{
3 base.OnRender(chartControl, chartScale);
4 // loop through only the rendered bars on the chart
5 for(int barIndex = ChartBars.FromIndex; barIndex <= ChartBars.ToIndex; barIndex++)
6 {
7 // get the close price at the selected bar index value
8 double closePrice = Bars.GetClose(barIndex);
9 Print("Bar #" + barIndex + " closing price is " + closePrice);
10 }
11}