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
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.