OPEN-SOURCE SCRIPT
Standard Deviation Supertrend | GForge

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 ๐ข๐น๐๐๐๐
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 ๐ข๐น๐๐๐๐
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.