Skip to main content

SWT Trend + Momentum

A complete wavelet-based trading system combining a smooth trend overlay with a directional energy momentum oscillator. Uses the Stationary Wavelet Transform (SWT/MODWT) for shift-invariant, noise-reduced trend analysis.

Overview

The SWT Trend + Momentum system provides:

  • Trend Line: Wavelet-smoothed price overlay showing underlying market direction
  • Momentum Oscillator: Directional energy measurement confirming trend strength
  • Automated Strategy: Optional buy/sell signals with position management

Unlike traditional moving averages that lag and react to noise, the wavelet trend line separates signal from noise mathematically, providing clearer trend visualization.

How It Works

Wavelet Decomposition

  1. Decomposition: Price data is transformed using SWT into multiple frequency layers
  2. Approximation (A_J): The lowest frequency layer represents the primary trend
  3. Details (D_J...D_1): Higher frequency layers contain noise and short-term fluctuations
  4. Denoising: Optional BayesShrink filter removes statistical noise from detail layers
  5. Reconstruction: Final trend = A_J + optional coarsest details for responsiveness

Directional Energy Momentum

The momentum oscillator measures trend conviction using wavelet energy:

Momentum = RMS(detail_coefficients) × sign(energy_asymmetry)
  • Positive (Green): Bullish energy dominates
  • Negative (Red): Bearish energy dominates
  • Magnitude: Strength of directional conviction

Display

Study Version

Price Chart (Overlay)

  • Blue trend line on price

Momentum Panel (Below)

  • Green histogram bars: Positive momentum
  • Red histogram bars: Negative momentum
  • Optional normalization: None, SNR, or Z-Score

Strategy Version

Same display plus:

  • Entry/exit arrows on chart
  • Position status in panel

Settings

Wavelet Transform

SettingDefaultDescription
Wavelet TypeDB4Wavelet family (DB4, DB6, SYM4, HAAR, etc.)
Decomposition Levels4Smoothness control (higher = smoother)
Use Denoised SignaltrueApply BayesShrink noise reduction
Trend Coarse Details (k)1Lag reduction (0 = smoothest, 1-2 = more responsive)

Momentum

SettingDefaultDescription
NormalizationNoneNone, SNR (signal-to-noise), or Z-Score
Momentum Threshold1.0Signal threshold (scaled by 100x internally)

Window Settings

SettingDefaultDescription
Auto Window SizetrueAutomatically calculate required bars
Auto Window Margin (γ)6.0Safety margin for auto calculation
Manual Window1024Manual lookback if auto disabled

Strategy Settings (Strategy Version Only)

SettingDefaultDescription
Min Slope Threshold0.05Minimum price points for trend confirmation
Trade Lots1.0Position size multiplier
Enable Long/ShortBothDirectional filtering

Usage Patterns

Trend Filter

Use the trend line slope to filter trades from other systems:

  • Slope Up: Only consider long trades
  • Slope Down: Only consider short trades
  • Flat: Avoid trend-following strategies

Example: Only act on RSI oversold signals when the wavelet trend is sloping up.

Dynamic Support/Resistance

The trend line acts as dynamic S/R:

  • Uptrend: Pullbacks find support near the trend line
  • Downtrend: Rallies stall near the trend line

Momentum Confirmation

Combine trend direction with momentum strength:

TrendMomentumSignal
UpStrong positiveHigh-conviction long
UpWeak/negativeWait for confirmation
DownStrong negativeHigh-conviction short
DownWeak/positiveWait for confirmation

Divergence Detection

Watch for momentum divergence:

  • Price makes new high, momentum doesn't → potential bearish reversal
  • Price makes new low, momentum doesn't → potential bullish reversal

Tuning Guide

Trend Too Slow?

  • Decrease Decomposition Levels by 1
  • Increase Trend Coarse Details (k) to 1 or 2

Trend Too Choppy?

  • Increase Decomposition Levels by 1
  • Ensure Use Denoised Signal is enabled
  • Set Trend Coarse Details (k) to 0
TimeframeLevelskNotes
1-5 min41Default, balanced
15-30 min4-51Slightly smoother
1 hour+50Very smooth for position trading

Troubleshooting

Study Not Plotting

  • Ensure sufficient historical data (256+ bars typically required)
  • Enable Auto Window Size for automatic calculation

Poor Performance

  • Stick to Auto Window sizing
  • Avoid very large manual window sizes on tick charts

See Also