GetBarIdxByTime()

<< Click to Display Table of Contents >>

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

GetBarIdxByTime()

Previous page Return to chapter overview Next page

Definition

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

 

Method Return Value

An int representing the bar index value at a specific time

 

Syntax
ChartBars.GetBarIdxByTime(ChartControl chartControl, DateTime time)

 

Method Parameters

chartControl

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

time

The DateTime value used to convert to a ChartBar index value

 

 

Examples

ns


protected override void OnBarUpdate()
{  
  if (ChartBars != null)  
  {        
    Print(ChartBars.GetBarIdxByTime(ChartControl, Time[0]));
  }
}