IsTickReplays

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > OnBarUpdate() >

IsTickReplays

Previous page Return to chapter overview Next page

Definition

Indicates the specified bar series is using Tick Replay.   Please see the help guide topic on using Tick Replay for general information on this mode.

 

Note:  For a primary series, the Tick Replay option must be configured from the UI before a NinjaScript object can take use of this property.  The setting on the Chart's Data Series menu will always take precedence for an object series which already exists on the user's chart.

 

 

Warning:  This property should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded

 

 

Property Value

A bool[] when true, indicates the specified BarsArray is setup to run Tick Replay; otherwise false.  Default value is false

 

Syntax

IsTickReplays[int idx]

 

 

Examples

ns


protected override void OnStateChange()
{
  if(State == State.SetDefaults)
  {
      Name = "Examples Indicator";
  }
 
  else if (State == State.Configure)
  {
    AddDataSeries("AAPL", BarsPeriodType.Minute, 1);  
 
    // Setting this option here for Primary does not take affect the data series    
    // Primary series must be configured from UI
    // IsTickReplays[0] = true;
   
    // It is not possible to combine Tick Replay series and Non-Tick-Replay series in a single chart or script
    // The assignment below would not be necessary if the primary series were set to True via the UI
    //IsTickReplays[1] = true; // AAPL, do not run tick replay (saves CPU)
 
  }
   
}
 
protected override void OnBarUpdate()
{                
  //Print out the current bars series name and tick replays setting on start up
  if (CurrentBar == 0)        
    Print(BarsArray[BarsInProgress].ToChartString() + " " + IsTickReplays[BarsInProgress]);
 
  //Output:
  //ES 03-15 (1 Minute) True
  //AAPL (1 Minute) False        
}