ta.tr
True 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
ta.trReturns
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
//@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
Frequently Asked Questions
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.
Related Pine Script Functions
ta.tr() - True Range Function
Learn how to use ta.tr() function in Pine Script. Syntax, parameters including handle_na, code examples for True Range.
ta.atr() - Average True Range
Learn how to use ta.atr() in Pine Script. Syntax, parameters, code examples for the Average True Range volatility indicator.
ta.rma() - Relative Moving Average
Learn how to use ta.rma() in Pine Script. Syntax, parameters, code examples for Wilder's smoothing method used in RSI calculation.
ta.bb() - Bollinger Bands
Learn how to use ta.bb() in Pine Script. Syntax, parameters, code examples for Bollinger Bands with upper, middle, and lower bands.
ta.kc() - Keltner Channels
Learn how to use ta.kc() in Pine Script. Syntax, parameters, code examples for Keltner Channel volatility bands.