GetSessionBar()
Previous Topic  Next Topic 

Definition
Returns a Bar object that represents a session whose properties for open, high, low, close, time and volume can be accessed. This bar is a virtual bar built off of the underlying data series. In some cases, the session bar can be used to represent a daily bar. Since this bar is virtual, its property values are calculated for the session time only and not represent the actual day. You must check for a null reference since null is returned if there is not sufficient intraday data to build a session bar.


!!! This method should ONLY be used for accessing prior session data. To access current session data, use the CurrentDayOHL() method.

Method Return Value

See below.


Syntax
The properties below return double values:

Bars.GetSessionBar(int sessionsAgo).Open
Bars.GetSessionBar(int sessionsAgo).High

Bars.GetSessionBar(int sessionsAgo).Low

Bars.GetSessionBar(int sessionsAgo).Close


The property below returns a DateTime structure:

Bars.GetSessionBar(int sessionsAgo).Time


The property below returns an int value:

Bars.GetSessionBar(int sessionsAgo).Volume

Method Of

Custom Indicator, Custom Strategy


Parameters

sessionsAgo

Number of sessions ago


Examples

// Print the prior session close
if (Bars.GetSessionBar(1) != null)
    Print("The prior session's close is: " + Bars.GetSessionBar(1).Close.ToString());