Range & PivotPine Script v6

ta.range()

Range

Returns the range (highest - lowest) of a series over a given number of bars.

Syntax

Syntax
ta.range(source, length) → series float

Arguments

ParameterTypeDescription
sourceseries int/floatSeries of values to process.
lengthseries intNumber of bars in the rolling window.

Returns

Difference between min and max values of source for length bars back.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.range")
plot(ta.range(close, 14))

Trading Applications

Measure price range for volatility assessment

Build range-based breakout systems

Calculate relative range for normalization

Use in custom channel indicators

Related Functions

Frequently Asked Questions

Generate ta.range() Code with AI

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