OPEN-SOURCE SCRIPT
SWMA Momentum SuperTrend | RakoQuant

SWMA Momentum SuperTrend by RakoQuant is a regime-aware trend system built on a Symmetrically Weighted Moving Average (SWMA) baseline, enhanced with momentum normalization and adaptive SuperTrend trailing logic.
Unlike traditional SuperTrend models that rely on raw EMA or simple smoothing, this version introduces:
* SWMA structural baseline
* ATR volatility envelopes
* Momentum gating logic
* Intraday smoothing filters
* Multi-mode parameter presets
The result is a SuperTrend variant designed to reduce noise while preserving structural transitions.
RakoQuant Architecture
1. SWMA Baseline (Symmetric Structure)
The baseline begins with:
SWMA → EMA smoothing layer
This dual-stage structure provides:
* Symmetric weighting (less directional bias than EMA alone)
* Reduced micro-volatility noise
* More balanced turning behavior
The SWMA core produces smoother curvature compared to single-pass EMA systems.
2. ATR Volatility Engine
Volatility bands are built using:
Upper Band = Baseline + (Factor × ATR) Lower Band = Baseline − (Factor × ATR)
Classic SuperTrend trailing logic is then applied to maintain:
* Regime continuity
* Non-repainting trailing structure
* Deterministic flip behavior
3. Momentum Gate (Normalized Bias Filter)
This is where the tool becomes distinctly RakoQuant.
Momentum is calculated as:
Baseline slope normalized by ATR
Then passed through a configurable gating system:
* Low gate = aggressive flipping
* High gate = strict confirmation
* 0 = no filter
This prevents:
* Weak volatility spikes from triggering flips
* Flat market oscillations
* Low-energy false transitions
Momentum alignment becomes required before regime change.
4. Mode Presets (Structural Adaptability)
Three operating modes are built in:
* Daily / Swing
* Intraday
* Custom
Each mode adjusts:
* SWMA smoothing
* ATR length
* Multiplier factor
* Momentum lookback
This makes the tool adaptable across timeframes without manual retuning.
Signal Model (RakoQuant Regime Logic)
The system operates using directional state:
* Bullish Regime when SuperTrend flips upward (dir < 0)
* Bearish Regime when SuperTrend flips downward (dir > 0)
Flip events are:
* Non-repainting
* Confirmed on candle close
* Alert-enabled
* Strategy-ready
Optional label markers and signal toggles allow clean backtesting.
Visual System
SWMA Momentum SuperTrend includes modular configuration:
* Multiple palettes (RakoQuant Neon, Classic, Gold/Indigo, Ocean/Coral, Mono)
* Line style options (Line Break default for smooth transitions)
* Glow layer control
* Optional baseline display
* Fill modes (to mid or to price)
* Candle painting toggle
* Flip marker toggle
The visual structure is built for clarity, not decoration.
Practical Use Cases
Trend Continuation Use momentum-gated flips to capture structured volatility expansion.
Intraday Regime Control Apply smoothing filter in lower timeframes to reduce chop.
Swing Trading Use Daily / Swing mode for broader structural alignment.
System Integration Works well alongside:
* Volume confirmation tools
* Higher timeframe bias
* Volatility compression systems
Design Philosophy (RakoQuant)
This tool reflects the RakoQuant principles:
* Structural symmetry over naive smoothing
* Volatility context over static envelopes
* Momentum confirmation over blind flipping
* Adaptive presets over rigid parameters
It is fully open-source, deterministic, and backtest-ready.
Chart Example

Unlike traditional SuperTrend models that rely on raw EMA or simple smoothing, this version introduces:
* SWMA structural baseline
* ATR volatility envelopes
* Momentum gating logic
* Intraday smoothing filters
* Multi-mode parameter presets
The result is a SuperTrend variant designed to reduce noise while preserving structural transitions.
RakoQuant Architecture
1. SWMA Baseline (Symmetric Structure)
The baseline begins with:
SWMA → EMA smoothing layer
This dual-stage structure provides:
* Symmetric weighting (less directional bias than EMA alone)
* Reduced micro-volatility noise
* More balanced turning behavior
The SWMA core produces smoother curvature compared to single-pass EMA systems.
2. ATR Volatility Engine
Volatility bands are built using:
Upper Band = Baseline + (Factor × ATR) Lower Band = Baseline − (Factor × ATR)
Classic SuperTrend trailing logic is then applied to maintain:
* Regime continuity
* Non-repainting trailing structure
* Deterministic flip behavior
3. Momentum Gate (Normalized Bias Filter)
This is where the tool becomes distinctly RakoQuant.
Momentum is calculated as:
Baseline slope normalized by ATR
Then passed through a configurable gating system:
* Low gate = aggressive flipping
* High gate = strict confirmation
* 0 = no filter
This prevents:
* Weak volatility spikes from triggering flips
* Flat market oscillations
* Low-energy false transitions
Momentum alignment becomes required before regime change.
4. Mode Presets (Structural Adaptability)
Three operating modes are built in:
* Daily / Swing
* Intraday
* Custom
Each mode adjusts:
* SWMA smoothing
* ATR length
* Multiplier factor
* Momentum lookback
This makes the tool adaptable across timeframes without manual retuning.
Signal Model (RakoQuant Regime Logic)
The system operates using directional state:
* Bullish Regime when SuperTrend flips upward (dir < 0)
* Bearish Regime when SuperTrend flips downward (dir > 0)
Flip events are:
* Non-repainting
* Confirmed on candle close
* Alert-enabled
* Strategy-ready
Optional label markers and signal toggles allow clean backtesting.
Visual System
SWMA Momentum SuperTrend includes modular configuration:
* Multiple palettes (RakoQuant Neon, Classic, Gold/Indigo, Ocean/Coral, Mono)
* Line style options (Line Break default for smooth transitions)
* Glow layer control
* Optional baseline display
* Fill modes (to mid or to price)
* Candle painting toggle
* Flip marker toggle
The visual structure is built for clarity, not decoration.
Practical Use Cases
Trend Continuation Use momentum-gated flips to capture structured volatility expansion.
Intraday Regime Control Apply smoothing filter in lower timeframes to reduce chop.
Swing Trading Use Daily / Swing mode for broader structural alignment.
System Integration Works well alongside:
* Volume confirmation tools
* Higher timeframe bias
* Volatility compression systems
Design Philosophy (RakoQuant)
This tool reflects the RakoQuant principles:
* Structural symmetry over naive smoothing
* Volatility context over static envelopes
* Momentum confirmation over blind flipping
* Adaptive presets over rigid parameters
It is fully open-source, deterministic, and backtest-ready.
Chart Example
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.