NinjaScript > Language Reference > Indicator >

Value

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Value references the first DataSeries object Values[0] in the indicator. This is the primary indicator value.

 

Property Value

A DataSeries object.

 

Syntax

Value

 

 

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 primary value 1 bar ago and sets the value of the indicator

    // for the current bar being evaluated

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

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

    else

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

}

 

 

Tips

1.The DataSeries object referenced by this property is created by calling the Add() method.