OPEN-SOURCE SCRIPT
DEMA Volatility SuperTrend | RakoQuant

DEMA Volatility SuperTrend is a clean trend-regime indicator built for volatile markets such as crypto.
It combines a Double Exponential Moving Average (DEMA) baseline with a standard deviation volatility envelope, then applies classic SuperTrend trailing logic to produce persistent bullish and bearish regimes.
This tool is designed for traders who want a smooth but responsive trend structure without relying on ATR alone.
Core Concept
This indicator answers one simple question:
Are we currently in a bullish trend regime or a bearish trend regime?
It does this by building a dynamic volatility corridor around a DEMA baseline and flipping only when price breaks beyond the active band.
How It Works
1. DEMA Baseline (fast + low lag)
A DEMA is used instead of a normal EMA to reduce lag while maintaining smooth trend behavior.
2. Volatility Engine (Standard Deviation)
Volatility bands are created using:
Raw Source Volatility
Classic standard deviation behavior
Residual vs Baseline Volatility
Measures deviations from the DEMA baseline for cleaner regime detection
Band formula:
Upper Band = baseline + multiplier × stdev
Lower Band = baseline − multiplier × stdev
3. SuperTrend Trailing Regime Logic
Instead of flipping every touch, the bands trail using SuperTrend persistence rules:
Bull regime → active lower band acts as support
Bear regime → active upper band acts as resistance
Flips occur only when price breaks beyond the trailing band.
Visual System
Bull regime: Ice-Blue active band
Bear regime: Violet active band
Optional faint inactive bands provide structure
Optional fill highlights the active regime corridor
Optional candle painting matches the regime state instantly
Alerts Included
Bull Flip Alert → regime turns bullish
Bear Flip Alert → regime turns bearish
Perfect for automation or regime-based filtering.
How to Use
✅ Trend filter for swing trading
✅ Regime confirmation layer for systems
✅ Works best on higher timeframes (4H / 1D)
✅ Combine with momentum or breakout triggers for entries
Inputs Summary
DEMA Length → baseline responsiveness
Volatility Length + Multiplier → band width + sensitivity
Volatility Mode → raw vs residual volatility
Flip Source → Close or HL2 for regime switching
Visual toggles → fill, candles, inactive rails
Screenshot Placement
📸 Example chart / screenshot:
Tip: show one bullish flip + one bearish flip with candle painting enabled.
It combines a Double Exponential Moving Average (DEMA) baseline with a standard deviation volatility envelope, then applies classic SuperTrend trailing logic to produce persistent bullish and bearish regimes.
This tool is designed for traders who want a smooth but responsive trend structure without relying on ATR alone.
Core Concept
This indicator answers one simple question:
Are we currently in a bullish trend regime or a bearish trend regime?
It does this by building a dynamic volatility corridor around a DEMA baseline and flipping only when price breaks beyond the active band.
How It Works
1. DEMA Baseline (fast + low lag)
A DEMA is used instead of a normal EMA to reduce lag while maintaining smooth trend behavior.
2. Volatility Engine (Standard Deviation)
Volatility bands are created using:
Raw Source Volatility
Classic standard deviation behavior
Residual vs Baseline Volatility
Measures deviations from the DEMA baseline for cleaner regime detection
Band formula:
Upper Band = baseline + multiplier × stdev
Lower Band = baseline − multiplier × stdev
3. SuperTrend Trailing Regime Logic
Instead of flipping every touch, the bands trail using SuperTrend persistence rules:
Bull regime → active lower band acts as support
Bear regime → active upper band acts as resistance
Flips occur only when price breaks beyond the trailing band.
Visual System
Bull regime: Ice-Blue active band
Bear regime: Violet active band
Optional faint inactive bands provide structure
Optional fill highlights the active regime corridor
Optional candle painting matches the regime state instantly
Alerts Included
Bull Flip Alert → regime turns bullish
Bear Flip Alert → regime turns bearish
Perfect for automation or regime-based filtering.
How to Use
✅ Trend filter for swing trading
✅ Regime confirmation layer for systems
✅ Works best on higher timeframes (4H / 1D)
✅ Combine with momentum or breakout triggers for entries
Inputs Summary
DEMA Length → baseline responsiveness
Volatility Length + Multiplier → band width + sensitivity
Volatility Mode → raw vs residual volatility
Flip Source → Close or HL2 for regime switching
Visual toggles → fill, candles, inactive rails
Screenshot Placement
📸 Example chart / screenshot:
Tip: show one bullish flip + one bearish flip with candle painting enabled.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
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.