VolatilityPine Script v6Built-in Variable

ta.trTrue Range (Variable)

True range, equivalent to ta.tr(handle_na = false). It is calculated as math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1])).

Syntax

Syntax
ta.tr

Returns

series float

Remarks

This is the built-in series variable ta.tr. For explicit NaN handling, use the ta.tr() function with handle_na.

Code Examples

Pine Script v6 Example
//@version=6
indicator("True Range (variable)")
plot(ta.tr, color=color.blue)

Trading Applications

Quick access to true range without a function call

Use in custom ATR calculations

Measure single-bar volatility

Detect gap bars with high true range

Related Functions

Frequently Asked Questions

ta.tr is a built-in series that holds the true range for each bar: the maximum of the bar range (high − low) and the absolute gaps from the prior close to the current high and low.

The variable behaves like ta.tr(handle_na = false). The function ta.tr() lets you set handle_na to change behavior when the previous close is na.

Use ta.tr when the default na behavior matches your script. Use ta.tr(handle_na) when you need to control how missing prior closes are handled.

Generate ta.tr Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.tr and other built-in functions instantly.