Attachments forums

List of attachments posted on this forum.


All files on forums: 163238

Re: 👨โ€🔬 Cagliostro's MT5 Laboratory

Cagliostro, Sat Dec 20, 2025 10:06 pm

ULTIMATE FLOW INDEX (UFI) v1.0
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
Each stage serves a specific purpose in the signal chain:

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))
Stage 2: Detrending
The raw MFI oscillates between 0 and 100. We center it around zero for easier interpretation:

Code: Select all

Detrended = MFI - 50
This produces values in the range [-50, +50], where zero represents equilibrium between buying and selling pressure.

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
where N = 4 (default). This prevents aliasing artifacts in the subsequent IIR filter.

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]
This recursive formulation achieves the smoothness of a much longer moving average while preserving responsiveness to genuine price movements.

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
4. CENTERLINE BOUNCE
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 "Age" counter shows how many bars have elapsed since the signal fired, helping you assess whether an opportunity is still fresh or potentially exhausted.
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)
For higher timeframes (H4+), consider increasing the Ehlers period to 5 for additional smoothing.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

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+
All files in topic