Sidechair

ta.tr

Browse the reference

The true range of the current bar: the largest of high - low, |high - previous close| and |low - previous close|.

Try it in the editor

ta.tr is a series variable that holds the true range for the bar being processed. It widens beyond high - low on a bar that gaps away from the previous close.

The first bar has no previous close, so ta.tr is na there. Use ta.tr(true) when the first bar should count as high - low.

Type

series float

Remarks

  • Read earlier bars with the history operator, for example ta.tr[1].

Example

Pine ScriptAverage of the variable formOpen in editor
//@version=6
indicator("TR average")
plot(ta.tr, "TR", color = color.new(color.gray, 40))
plot(ta.sma(ta.tr, 14), "SMA of TR", color = color.orange, linewidth = 2)

See also

Runs on Sidechair