GetSessionEndTime()

View as Markdown

Definition

Returns the daily bar session ending time stamp relative to the current bar index value.

This method is ONLY intended for bars built from daily data. If called on intraday data, GetSessionEndTime() will return the Bars.GetTime() value.

Method Return Value

A DateTime structure that represents the daily bars ending time stamp at the desired bar index; intraday bars will return the time stamp at the current bar index value.

Syntax

Bars.GetSessionEndTime(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 time stamp at the selected bar index value
8 DateTime timeValue = Bars.GetSessionEndTime(barIndex);
9 Print("Bar #" + barIndex + " time stamp is " + timeValue);
10 }