GetOpen()

View as Markdown

Definition

Returns the open price at the selected bar index value.

Method Return Value

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

Syntax

Bars.GetOpen(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 open price at the selected bar index value
8 double openPrice = Bars.GetOpen(barIndex);
9 Print("Bar #" + barIndex + " open price is " + openPrice);
10 }
11}