A Volume-Weighted Momentum Oscillator with Ehlers Digital Signal Processing
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Introduction
Most momentum oscillators suffer from two fundamental problems: excessive noise in their output and complete disregard for volume information. The Ultimate Flow Index addresses both issues by combining the volume-weighted Money Flow Index with Ehlers' UltimateSmoother filter, producing a responsive yet smooth oscillator that reveals the true underlying momentum of price action.
The core insight is simple: price movement without volume is suspect, while price movement confirmed by volume deserves attention. By starting with MFI rather than RSI or a simple momentum calculation, we ensure that every signal carries volume confirmation built into its DNA.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Signal Processing Pipeline
The UFI processes data through a carefully designed four-stage pipeline:
Code: Select all
MFI(14) โ Detrend โ SMA(4) โ UltimateSmoother(3) โ EMA(9)
[0-100] [-50,+50] Pre-smooth Ehlers IIR Signal Line
Stage 1: Money Flow Index
The foundation is the standard Money Flow Index, which incorporates both price and volume:
Code: Select all
Typical Price = (High + Low + Close) / 3
Money Flow = Typical Price ร Volume
Money Ratio = Positive Money Flow / Negative Money Flow
MFI = 100 - (100 / (1 + Money Ratio))
The raw MFI oscillates between 0 and 100. We center it around zero for easier interpretation:
Code: Select all
Detrended = MFI - 50
Stage 3: Pre-Smoothing (SMA)
A short Simple Moving Average removes the highest-frequency noise before the main filter:
Code: Select all
PreSmooth[i] = (1/N) ร ฮฃ Detrended[i-k] for k = 0 to N-1
Stage 4: Ehlers UltimateSmoother
The heart of UFI is Ehlers' UltimateSmoother, a two-pole Butterworth IIR filter that provides superior smoothing with minimal lag:
Code: Select all
aโ = exp(-โ2 ร ฯ / Period)
cโ = 2 ร aโ ร cos(โ2 ร ฯ / Period)
cโ = -aโยฒ
cโ = (1 + cโ - cโ) / 4
UFI[i] = (1 - cโ) ร Input[i]
+ (2cโ - cโ) ร Input[i-1]
- (cโ + cโ) ร Input[i-2]
+ cโ ร UFI[i-1]
+ cโ ร UFI[i-2]
Stage 5: Signal Line (EMA)
Finally, an Exponential Moving Average provides crossover signals:
Code: Select all
ฮฑ = 2 / (Period + 1)
Signal[i] = ฮฑ ร UFI[i] + (1 - ฮฑ) ร Signal[i-1]
Signal Generation Modes
UFI v1.0 offers five distinct signal generation algorithms, each suited to different market conditions:
1. DIVERGENCE
The most powerful signal type for any oscillator. Detects when price makes a new extreme while the oscillator fails to confirm:
Bullish Divergence: Price makes Lower Low, UFI makes Higher Low
Bearish Divergence: Price makes Higher High, UFI makes Lower High
These signals often precede significant reversals and are inherently filtered by the volume-weighted nature of UFI.
2. EXTREME REVERSAL
A two-stage confirmation system:
UFI exits overbought (>20) or oversold (<-20) zone
Within N bars, UFI crosses its signal line in the reversal direction
This ensures we don't act on every exit from extreme zonesโonly those with momentum confirmation.
3. MOMENTUM SURGE
Detects sudden accelerations in money flow, ideal for catching breakouts:
Code: Select all
Delta = UFI[i] - UFI[i-1]
Acceleration = Delta - PreviousDelta
Signal when: |Delta| > Threshold AND Acceleration confirms direction
Identifies trend continuation when UFI tests zero but fails to cross:
Bullish: UFI dips from positive to near-zero, then bounces back up
Bearish: UFI rises from negative to near-zero, then falls back down
This signal type works best in trending markets.
5. HOOK + CROSS
The most conservative mode, requiring:
Exit from extreme zone with momentum (the "hook")
Signal line crossover within a confirmation window
Two confirmations reduce false signals at the cost of slightly later entries.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Signal Status Display
The indicator displays the current signal status in the upper-right corner of the subwindow:
Code: Select all
โฒ DIVERGENCE SELL
Age: 12 bars
The signal remains active until UFI crosses zero in the opposite direction.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Technical Features
No Repaint: All calculations use confirmed bar data only
Multi-Instance Safe: Unique prefix system prevents object conflicts
18 Color Themes: Professional palettes via QuantumColorThemes
8 Arrow Styles: Heavy/Light barbs, blocks, 3D heads, shapes
Full Alert System: Popup, sound, push notification, email
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Recommended Settings
Code: Select all
MFI Period: 14 (standard)
Pre-Smoothing: 4 (anti-aliasing)
Ehlers Period: 3 (responsive) or 5 (smoother)
Signal Period: 9 (crossover sensitivity)
OB/OS Levels: ยฑ20 (default) or ยฑ15 (more signals)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Acknowledgments
The UltimateSmoother filter implementation follows the methodology described by John F. Ehlers in his work on digital signal processing for traders. The volume-weighting approach builds upon J. Welles Wilder's original Money Flow concepts.
+C+