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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。