OPEN-SOURCE SCRIPT
Keltner SD SuperTrend | RakoQuant

Keltner SD SuperTrend by RakoQuant is a structural trend-following system that replaces ATR volatility with Standard Deviation inside a SuperTrend framework.
Instead of using raw range-based expansion, this model measures statistical dispersion around an EMA baseline, producing cleaner volatility envelopes in both compression and expansion phases.
The result is a SuperTrend variant that reacts to true deviation structure, not just candle range.
RakoQuant Architecture
1. EMA Baseline (Structural Mean)
The core baseline is an EMA:
* Provides directional bias
* Anchors volatility expansion
* Serves as slope reference for momentum gating
This keeps the model responsive without being overly reactive.
2. Standard Deviation Volatility (σ Engine)
Instead of ATR, this system uses:
Upper Band = EMA + (Multiplier × StdDev) Lower Band = EMA − (Multiplier × StdDev)
This shifts the logic from range volatility to statistical dispersion.
Key effects:
* Compression phases tighten sharply
* Breakouts emerge from structured contraction
* Noise-based volatility spikes are reduced
* Trend shifts become more statistically defined
3. SuperTrend Trailing Logic
Classic trailing band mechanics are applied:
* Bands trail only in trend direction
* Once flipped, they do not reset until structurally broken
* Regime continuity is maintained
This prevents band “repainting” behavior and keeps state transitions clean.
4. Momentum Gate (Structural Confirmation)
An optional slope-based confirmation layer is included:
Momentum = EMA slope normalized by Standard Deviation
This ensures:
* Flips require directional bias
* Weak breaks in flat conditions are filtered
* Volatility expansion aligns with structural movement
It adds discipline without over-complicating the model.
Signal Model (RakoQuant Regime Logic)
The indicator operates using state-based architecture:
* Bullish Regime when SuperTrend flips upward
* Bearish Regime when SuperTrend flips downward
Flip events are:
* Deterministic
* Backtest-ready
* Alert-enabled
No repainting. No hidden smoothing. Clean state transitions.
Visual System
Keltner SD SuperTrend includes modular visual configuration:
* Multiple palette options (RakoQuant Neon, Classic, Gold/Indigo, Ocean/Coral, Mono)
* Line style control (Line Break default to prevent shelf artifacts)
* Dual-layer glow system
* Optional fill (to mid or to price)
* Optional EMA baseline display
* Candle painting toggle
* Optional UP/DN markers
The default Line Break style avoids the “box shelf” effect common in naive SuperTrend implementations.
Practical Use Cases
Trend Continuation Use flips to capture directional expansion from statistical compression.
Breakout Detection Watch for SD tightening before regime transition.
Volatility Rotation Observe how dispersion expands during strong directional phases.
System Integration Pairs cleanly with:
* Momentum oscillators
* Volume filters
* Higher timeframe bias systems
Design Philosophy (RakoQuant)
This tool reflects the RakoQuant framework:
* Statistical dispersion > raw range volatility
* Structural regime tracking > visual-only overlays
* Deterministic outputs > black-box smoothing
* Strategy-ready architecture
Everything is manual, open-source, and reproducible.
Chart Example

Instead of using raw range-based expansion, this model measures statistical dispersion around an EMA baseline, producing cleaner volatility envelopes in both compression and expansion phases.
The result is a SuperTrend variant that reacts to true deviation structure, not just candle range.
RakoQuant Architecture
1. EMA Baseline (Structural Mean)
The core baseline is an EMA:
* Provides directional bias
* Anchors volatility expansion
* Serves as slope reference for momentum gating
This keeps the model responsive without being overly reactive.
2. Standard Deviation Volatility (σ Engine)
Instead of ATR, this system uses:
Upper Band = EMA + (Multiplier × StdDev) Lower Band = EMA − (Multiplier × StdDev)
This shifts the logic from range volatility to statistical dispersion.
Key effects:
* Compression phases tighten sharply
* Breakouts emerge from structured contraction
* Noise-based volatility spikes are reduced
* Trend shifts become more statistically defined
3. SuperTrend Trailing Logic
Classic trailing band mechanics are applied:
* Bands trail only in trend direction
* Once flipped, they do not reset until structurally broken
* Regime continuity is maintained
This prevents band “repainting” behavior and keeps state transitions clean.
4. Momentum Gate (Structural Confirmation)
An optional slope-based confirmation layer is included:
Momentum = EMA slope normalized by Standard Deviation
This ensures:
* Flips require directional bias
* Weak breaks in flat conditions are filtered
* Volatility expansion aligns with structural movement
It adds discipline without over-complicating the model.
Signal Model (RakoQuant Regime Logic)
The indicator operates using state-based architecture:
* Bullish Regime when SuperTrend flips upward
* Bearish Regime when SuperTrend flips downward
Flip events are:
* Deterministic
* Backtest-ready
* Alert-enabled
No repainting. No hidden smoothing. Clean state transitions.
Visual System
Keltner SD SuperTrend includes modular visual configuration:
* Multiple palette options (RakoQuant Neon, Classic, Gold/Indigo, Ocean/Coral, Mono)
* Line style control (Line Break default to prevent shelf artifacts)
* Dual-layer glow system
* Optional fill (to mid or to price)
* Optional EMA baseline display
* Candle painting toggle
* Optional UP/DN markers
The default Line Break style avoids the “box shelf” effect common in naive SuperTrend implementations.
Practical Use Cases
Trend Continuation Use flips to capture directional expansion from statistical compression.
Breakout Detection Watch for SD tightening before regime transition.
Volatility Rotation Observe how dispersion expands during strong directional phases.
System Integration Pairs cleanly with:
* Momentum oscillators
* Volume filters
* Higher timeframe bias systems
Design Philosophy (RakoQuant)
This tool reflects the RakoQuant framework:
* Statistical dispersion > raw range volatility
* Structural regime tracking > visual-only overlays
* Deterministic outputs > black-box smoothing
* Strategy-ready architecture
Everything is manual, open-source, and reproducible.
Chart Example
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。