<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common >


Previous page Return to chapter overview Next page


ISeries<T> is an interface that is implemented by all NinjaScript classes that manage historical data as an ISeries<double> (Open, High, Low, Close, etc), used for indicator input, and other object data.  Please see the help guide article on Working with Price Series for a basic overview on how to access this information.


Types of ISeries


Represents a generic custom data structure for custom development


Historical price data structured as an ISeries<double> interface (Close[0], High[0], Low[0], etc)


Historical time stamps structured as an ISeries<DateTime> interface (Time[0])


Historical volume data structured as an ISeries<double> interface (Volume[0])



Methods and Properties


Returns the underlying input value at a specified bar index value.


Indicates if the specified input is set at a barsAgo value relative to the current bar.


Indicates if the specified input is set at a specified bar index value.


Return the number total number of values in the ISeries array


Tips: (see examples below)

1.By specifying a parameter of type ISeries<double>, you can then pass in an array of closing prices, an indicator, or a user defined data series.

2.When working with ISeries<double> objects in your code you may come across situations where you are not sure if the value being accessed is a valid value or just a "placeholder" value. To check if you are using valid values for your logic calculations that have been explicitly set, please use .IsValidDataPoint(int barsAgo) to check.




ns Using ISeries as a method parameter

//create custom a method named DoubleTheValue that accepts any object that implements
// the ISeries<double> interface as a parameter
private double DoubleTheValue(ISeries<double> priceData)
    return priceData[0] * 2;
protected override void OnBarUpdate()
  // This custom method is then used twice,
  //the first time passing in an array of closing prices
  //and the second time passing in a 20 period simple moving average.



ns Checking ISeries value before accessing

protected override void OnBarUpdate()
    // Only set our plot if the input is a valid value
    if (Input.IsValidDataPoint(0))
        Plot0[0] = Input[0];