TrueRange ( IDataHolder high , IDataHolder close , IDataHolder low );
Description
Returns the true range (TR).
TR is the greatest of the following:
- the difference between the current high and the current low
- the difference between the current high and the previous close
- the difference between the previous close and the current low
Input parameters
Parameter | Default value | Description |
---|---|---|
high | - | Defines the High price to be used in calculation. |
close | - | Defines the Close price to be used in calculation. |
low | - | Defines the Low price to be used in calculation. |
Example
script TrueRangeTS {
input high = high;
input close = close;
input low = low;
plot TrueRangeTS = Max(close[1], high) - Min(close[1], low);
}
plot TrueRange1 = TrueRange(high, close, low);
plot TrueRange2 = TrueRangeTS(high, close, low);
The example plots the TR using the manual thinkScript® implementation and the built-in function. The resulting plots coincide forming a single curve.