ta.range()
Range
Returns the range (highest - lowest) of a series over a given number of bars.
Syntax
ta.range(source, length) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
| length | series int | Number 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
//@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
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.
Related Pine Script Functions
ta.highest() - Highest Value
Learn how to use ta.highest() in Pine Script. Find the highest value over a lookback period for Donchian Channels.
ta.lowest() - Lowest Value
Learn how to use ta.lowest() in Pine Script. Find the lowest value over a lookback period.
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.stdev() - Standard Deviation
Learn how to use ta.stdev() in Pine Script. Syntax, parameters, code examples for statistical standard deviation 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.