OPEN-SOURCE SCRIPT

Standard Deviation Supertrend | GForge

162
Standard Deviation Supertrend ~ 𝒢𝐹𝑜𝓇𝑔𝑒

A Supertrend indicator that replaces ATR with Standard Deviation for volatility measurement, combined with a selectable Moving Average anchor for noise reduction.

━━━━━━━━━━━━━━━━━━━━━━━━

What This Indicator Does

This is a trend-following overlay that plots a single trailing line on your chart. When price is above the line, the trend is bullish. When price crosses below, the trend flips bearish. Signals fire on each flip.

The core mechanic is identical to the classic Supertrend — ratcheting bands that tighten in the direction of the trend and only reset when price breaks through the opposite side.

━━━━━━━━━━━━━━━━━━━━━━━━

Why Standard Deviation Instead of ATR

ATR measures the average candle range. It treats all bars the same — a strong directional candle and a choppy gap produce equal ATR contributions.

Standard Deviation measures how far price disperses from its mean. During clean directional moves, prices cluster on one side of the mean, producing low StdDev and tighter bands. During erratic, sideways price action, prices scatter around the mean, producing high StdDev and wider bands.

The result: the trailing stop naturally tightens when the trend is clean and loosens when conditions are noisy. This is adaptive behavior that ATR-based Supertrends don't provide.

━━━━━━━━━━━━━━━━━━━━━━━━

Two Smoothing Layers

Raw Supertrend inputs can be noisy. A single wick or volatile candle can jerk the trailing band and cause a premature flip. This indicator addresses that with two optional smoothing layers:
Anchor MA — applies a Moving Average to the price source before bands are calculated. Instead of building bands around raw hl2 (which reacts to every wick), the bands are built around a smoother baseline. 11 MA types are available:

• None (hl2) — raw, classic Supertrend behavior
• SMA, EMA, WMA — standard options with varying lag
• HMA — very low lag, can overshoot on reversals
• DEMA, TEMA — reduced lag variants of EMA
• VWMA — volume-weighted, naturally anchors to high-volume levels
• RMA — Wilder's smoothing, very stable
• ALMA — Gaussian-weighted with tunable offset and sigma
• T3 — Tillson, extremely smooth with adjustable volume factor

StdDev Smoothing — applies an EMA to the raw Standard Deviation output before it scales the bands. This prevents abrupt band width changes when a volatile bar enters or exits the lookback window. Set to 1 to disable.

Together, these improve parameter robustness — small changes to settings produce smaller changes in output, meaning the indicator is less likely to break under slight parameter variation.

━━━━━━━━━━━━━━━━━━━━━━━━

Settings Overview

• Anchor Source — price input for the Supertrend. hl2 is the classic default.
• StdDev Length — lookback period for the Standard Deviation calculation.
• StdDev Multiplier — band width. Higher values require a larger move to flip direction. This serves the same purpose as a "threshold" in oscillator-based indicators.
• Anchor MA Type / Length — which Moving Average smooths the anchor, and its period.
• StdDev Smoothing — EMA period applied to the raw StdDev. 1 = no smoothing.
• ALMA Offset / Sigma — only active when ALMA is selected.
• T3 Volume Factor — only active when T3 is selected.
• Current settings work best on BTC 1D

━━━━━━━━━━━━━━━━━━━━━━━━

Visual Elements

• Glow trail — the Supertrend line pulses with a layered glow that changes color on trend direction.
• Trend fill — gradient fill between price and the trailing line.
• Inactive band — shown as crosses, marking where the opposite flip point sits.
• Anchor MA line — subtle reference line showing the smoothed anchor (hidden when set to None).
• Bar coloring — candles colored by current trend direction.
• Signal diamonds — dual-layer markers (halo + core) on trend flips.
All visual elements can be toggled on or off individually. 13 color themes are included.

━━━━━━━━━━━━━━━━━━━━━━━━

⚠️ Disclaimer

This indicator is a technical analysis tool, not financial advice. It does not guarantee profitable results. Past performance on any asset or timeframe does not indicate future results. No indicator can predict market direction with certainty.
Always use proper risk management. Do not rely on any single indicator for trading decisions. Test thoroughly on your chosen instruments and timeframes before applying to live markets. You are solely responsible for your own trading decisions and outcomes.

━━━━━━━━━━━━━━━━━━━━━━━━
Developed by 𝒢𝐹𝑜𝓇𝑔𝑒

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.