NinjaScript > Language Reference > Indicator >

Values

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Values is a collection holding DataSeries objects that hold the indicator's underlying calculated values.

DataSeries objects held by this collection are added by calling the Add() method.

 

Property Value

A collection of DataSeries objects.

 

Syntax

Values[int index]

 

 

Examples

// OnBarUpdate method of a custom indicator

protected override void OnBarUpdate()

{

    // Ensures we have enough bars loaded for our indicator

    if (CurrentBar < 1)

        return;

 

    // Checks the indicator's secondary value 1 bar ago and sets the value of the indicator

    // for the current bar being evaluated

    if (Values[1][1] < High[0] - Low[0])

         Value.Set(High[0] - Low[0]);

    else

         Value.Set(High[0] - Close[0]);

}