NinjaScript > Language Reference > Indicator >
Value
Definition Value references the first DataSeries object Values[0] in the indicator. This is the primary indicator value.
Property Value
A DataSeries object.
Syntax
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