Indicator · Pine Script v6 · On the chart

Stoller Average Range Channel (STARCHANNEL)

by mihakralj

The Stoller Average Range Channel (STARCHANNEL) plots volatility-based bands around a central baseline directly on the price chart.

View on GitHub

GitHub stars47on the repository
Pine versionv6current
Lines of code69
Settings3inputs
LicenceMIT
Last update8 months ago28 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

69 lines of Pine Script v6 from indicators/channels/starchannel.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

starchannel.pine
// The MIT License (MIT)
// © mihakralj
//@version=6
indicator("Stoller Average Range Channel (STARCHANNEL)", "STARCHANNEL", overlay=true)

//@function Calculates Stoller Average Range Channel using ATR for width and SMA for center
//@param source Source series for the center line
//@param length Period for ATR and SMA calculations
//@param multiplier ATR multiplier for band width
//@returns tuple with [middle, upper, lower] band values
//@optimized Uses circular buffer for SMA and ATR with compensator, O(1) complexity
starchannel(series float source, simple int length, simple float multiplier) =>
    if length <= 0 or multiplier <= 0.0
        runtime.error("Length and multiplier must be greater than 0")
    var float prevClose = close
    float tr1 = high - low
    float tr2 = math.abs(high - prevClose)
    float tr3 = math.abs(low - prevClose)
    float trueRange = math.max(tr1, tr2, tr3)
    prevClose := close
    var int p = math.max(1, length)
    var int head = 0
    var int count = 0
    var array<float> bufferSource = array.new_float(p, na)
    var array<float> bufferTR = array.new_float(p, na)
    var float sumSource = 0.0
    var float sumTR = 0.0
    float oldestSource = array.get(bufferSource, head)
    float oldestTR = array.get(bufferTR, head)
    if not na(oldestSource)
        sumSource -= oldestSource
        sumTR -= oldestTR
        count -= 1
    float currentSource = nz(source)
    float currentTR = nz(trueRange)
    sumSource += currentSource
    sumTR += currentTR
    count += 1
    array.set(bufferSource, head, currentSource)
    array.set(bufferTR, head, currentTR)
    head := (head + 1) % p
    var float EPSILON = 1e-10
    var float raw_rma = 0.0
    var float e = 1.0
    float atrValue = na
    if not na(trueRange)
        float alpha = 1.0 / float(length)
        raw_rma := (raw_rma * (length - 1) + trueRange) / length
        e := (1.0 - alpha) * e
        atrValue := e > EPSILON ? raw_rma / (1.0 - e) : raw_rma
    float middleBand = nz(sumSource / count, source)
    float width = nz(atrValue * multiplier)
    [middleBand, middleBand + width, middleBand - width]

// ---------- Main loop ----------

// Inputs
i_source = input.source(close, "Source")
i_length = input.int(20, "Length", minval=1)
i_mult = input.float(2.0, "ATR Multiplier", minval=0.001)

// Calculation
[middle, upper, lower] = starchannel(i_source, i_length, i_mult)

// Plot
plot(middle, "Middle", color=color.yellow, linewidth=2)
p1 = plot(upper, "Upper", color=color.yellow, linewidth=2)
p2 = plot(lower, "Lower", color=color.yellow, linewidth=2)
fill(p1, p2, color=color.new(color.blue, 90), title="Band Fill")

Overview

Stoller Average Range Channel (STARCHANNEL) calculates a middle line using a simple moving average of the selected price source and constructs upper and lower boundaries by adding and subtracting a multiple of the Average True Range. Configurable settings allow adjustments to the input source, calculation length, and ATR multiplier. The script displays the three channel lines with a colored fill between the upper and lower boundaries.

Details

Published by

mihakralj on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Volatility & bands, Moving averages, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pinescriptpinescript-indicatorstechnical-analysistradingview-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Sourcesourceclosei_source
Lengthint20i_length
ATR Multiplierfloat2.0i_mult
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

318 stars

This indicator plots four customizable moving averages directly on the main price chart using default lengths of 3, 8, 21, and 50 periods. It fills the space between adjacent averages in green or maroon depending on trend alignment. Additionally, it computes B

Indicator v5 Moving averagesTrend
Updated 2 months ago · MIT GitHub repository of Multiple Moving Averages

NVDA Trend Ribbon

by longsurf-ai
277 stars

This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre

Indicator v6 TrendMoving averages
Updated yesterday · MIT GitHub repository of NVDA Trend Ribbon

Bollinger Bands Force

by harryguiacorn
219 stars

This indicator modifies standard Bollinger Bands to measure directional trend force based on line alignment. It calculates a simple moving average basis along with upper and lower volatility bands. When all three lines move upward or downward simultaneously, i

Indicator v5 Volatility & bandsTrend
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Force

Adaptive MA Slope

by capissimo
114 stars

This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Adaptive MA Slope

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers