Click or drag to resize

True Range

TrueRange is a technical analysis volatility indicator. The indicator does not provide an indication of price trend, simply the degree of price volatility. The range of a day's trading is simply high − low. The true range extends it to yesterday's closing price if it was outside of today's range.

The true range is the largest of the:

The idea of ranges is that they show the commitment or enthusiasm of traders. Large or increasing ranges suggest traders prepared to continue to bid up or sell down a stock through the course of the day. Decreasing range suggests waning interest.

Calculation

True Range 001

Chart Example

True Range 002

Implementation and Usage

Indicator has no input parameters. To initialize TrueRange indicator use the following constructor:

TrueRange

Use

TR - property to get current value

Example
C#
 1// Create new instance
 2TrueRange tr = new TrueRange();
 3
 4// Number of stored values
 5tr.HistoryCapacity = 2;
 6
 7// Add new data point
 8tr.Add(Bars.Current.Open, Bars.Current.High, Bars.Current.Low, Bars.Current.Close, Bars.Current.Volume);
 9
10// Get indicator value
11double IndicatorValue = tr.TR;
12// Get previous value
13if (tr.HistoryCount == 2)
14{
15    double IndicatorPrevValue = tr[1];
16}