Indicator · Pine Script v5 · On the chart

SPE Cone Bands

by SeraKah-1

An overlay indicator that draws a fan-shaped band projecting forward from the last bar.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code35
Settings5inputs
LicenceMIT
Last update3 months ago26 Jul 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

35 lines of Pine Script v5 from tradingview/SPE_Cone_Bands.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

SPE_Cone_Bands.pine
// SPE Volatility Cone Bands (overlay) — Pine v5
// Fan-style uncertainty band using rolling vol (GARCH-like visual, not full GARCH).
// Median path = drift from recent mean return; bands = ± z * vol * sqrt(h).

//@version=5
indicator("SPE Cone Bands", shorttitle="SPE-Cone", overlay=true, max_lines_count=500, max_labels_count=50)

volWin  = input.int(60, "Vol window", minval=10)
driftWin= input.int(60, "Drift window", minval=10)
horizon = input.int(21, "Horizon (bars forward)", minval=1, maxval=100)
z80     = input.float(1.2816, "z for ~80% band", step=0.01)
showFill= input.bool(true, "Fill cone")

ret   = ta.change(math.log(close))
mu    = ta.sma(ret, driftWin)
sig   = ta.stdev(ret, volWin)

// Only draw on last bar for cleanliness
if barstate.islast and not na(mu) and not na(sig)
    float last = close
    // polyline via lines
    for i = 1 to horizon
        // expected log price
        float med = last * math.exp(mu * i)
        float half = last * math.exp(mu * i) * (math.exp(z80 * sig * math.sqrt(i)) - 1.0)
        // approximate upper/lower in price space
        float up = last * math.exp(mu * i + z80 * sig * math.sqrt(i))
        float dn = last * math.exp(mu * i - z80 * sig * math.sqrt(i))
        // connect segments
        line.new(bar_index + i - 1, i == 1 ? last : last * math.exp(mu * (i - 1)), bar_index + i, med, color=color.orange, width=2)
        line.new(bar_index + i - 1, i == 1 ? last : last * math.exp(mu * (i - 1) + z80 * sig * math.sqrt(i - 1)), bar_index + i, up, color=color.new(color.teal, 30), width=1)
        line.new(bar_index + i - 1, i == 1 ? last : last * math.exp(mu * (i - 1) - z80 * sig * math.sqrt(i - 1)), bar_index + i, dn, color=color.new(color.teal, 30), width=1)

// Also plot trailing realized vol on pane via plotchar optional
plotchar(sig, title="daily vol", char="", location=location.top, color=color.new(color.teal, 100))

Overview

SPE Cone Bands uses the rolling mean and standard deviation of log returns to extend a median line and upper and lower lines by a chosen number of bars, scaled by a z-value input. It is a visual volatility spread, not a forecast, and the author says it is not a full GARCH model. It redraws on the latest bar.

Details

Published by

SeraKah-1 on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Volatility & bands

Markets

Stocks

Timeframes

H4 and above

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

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

SettingTypeDefaultVariable
Vol windowint60volWin
Drift windowint60driftWin
Horizon (bars forward)int21horizon
z for ~80% bandfloat1.2816z80
Fill conebooltrueshowFill
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

Chandelier Exit

by everget
948 stars

This indicator plots an ATR-based Chandelier Exit trailing stop on the price chart. It tracks a long stop under recent highs and a short stop above recent lows, then switches direction when price crosses the opposite stop. Buy and sell labels mark those flips.

Indicator v6 Volatility & bandsTrend Repaints
Updated 11 days ago · GPL-3.0 GitHub repository of Chandelier Exit

ICT Liquidity Void Fill

by ArunKBhaskar
575 stars

This overlay indicator marks ICT liquidity void fills on the price chart and can show long and short signals. It places a Fibonacci level inside a displacement candle, defaulting to the midpoint, and draws lines in a chosen style. Optional filters limit the fi

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Void Fill

This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
318 stars

This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos

Indicator v5 TrendVolatility & bands
Updated 2 months ago · MIT GitHub repository of ATR Trailing Stoploss

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 2 days ago · MIT GitHub repository of NVDA Trend Ribbon

Algo AVT

by ricardosantos79
261 stars

This indicator calculates an outlier-filtered moving average based on statistical filtering concepts. It stores close prices in a rolling array over a user-defined length, calculates the mean and standard deviation, and excludes values falling within a specifi

Indicator v4 Moving averagesVolatility & bands
Updated 4 years ago · None stated GitHub repository of Algo AVT

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