Skip to main content

ta.atr(high, low, close, length) - Average True Range

Wilder-smoothed (RMA) average of the true range. Returns a positive scalar representing volatility in price units.

ta.stdev(source, length) - Standard deviation

Population standard deviation of source over length bars.

ta.variance(source, length) - Variance

Square of the standard deviation: stdev^2.

ta.dev(source, length) - Mean absolute deviation

Average absolute distance from the mean. Less sensitive to outliers than standard deviation.

ta.bb(source, length, mult) - Bollinger Bands

Returns { upper, middle, lower }. middle is the SMA; upper/lower are middle ± mult * stdev.

ta.keltner(source, high, low, close, length, mult) - Keltner Channel

Returns { upper, middle, lower }. middle is the EMA of source; bands are middle ± mult * ATR.

Squeeze momentum setup

Combining BB and Keltner to detect low-volatility “squeeze”:

Bollinger Bands example

Full working BB indicator with band shading.

Oscillators

Momentum and oscillator functions.

Aggregators

ta.highest and ta.lowest for range-based calculations.