GetTimeByBarIdx()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > Charts > ChartBars >

GetTimeByBarIdx()

Previous page Return to chapter overview Next page

Definition

Returns the ChartBars time value calculated from a bar index parameter provided.

 

Method Return Value

A DateTime struct representing a bar time value at a specific bar index value

 

Syntax
ChartBars.GetTimeByBarIdx(ChartControl chartControl, int barIndex)

 

Method Parameters

chartControl

The ChartControl object used to determine the chart's time axis

barIndex

An int value representing a bar index used to convert to a ChartBar index value

 

 

Examples

ns

protected override void OnBarUpdate()
{
  if (ChartBars != null)
  {
    Print(ChartBars.GetTimeByBarIdx(ChartControl, 50)); //8/11/2015 4:30:00 AM    
  }
}