Money Flow Index - MFI | TR🎯 Overview
Money Flow Index - MFI | TR is a volume-weighted momentum oscillator that measures the strength of money flowing in and out of a security over a specified period. Developed by Tiagorocha1989, this enhanced version of the classic Money Flow Index combines price and volume data to identify overbought and oversold conditions, detect divergences, and generate clear trading signals with dual-mode operation and comprehensive visual features.
🔧 How It Works
The Money Flow Index (MFI) is often referred to as the volume-weighted Relative Strength Index (RSI). It uses both price and volume to measure buying and selling pressure, providing a more complete picture of market dynamics than price-only oscillators.
Core Calculation Logic:
The MFI calculation follows these steps:
Typical Price: (High + Low + Close) / 3 for each period
Money Flow: Typical Price × Volume
Money Flow Ratio:
If Typical Price increases, it's Positive Money Flow
If Typical Price decreases, it's Negative Money Flow
Money Flow Ratio = (Sum of Positive Money Flow over n periods) / (Sum of Negative Money Flow over n periods)
MFI: 100 - (100 / (1 + Money Flow Ratio))
The resulting oscillator oscillates between 0 and 100, with:
Readings above 80 suggesting overbought conditions (potential reversal down)
Readings below 20 suggesting oversold conditions (potential reversal up)
50 level serving as the centerline indicating neutral momentum
The indicator compares MFI to a reference line that can be either:
The traditional 50 level (centerline)
A user-defined moving average of MFI itself (MFI MA mode)
✨ Key Features
🔹 Dual Operating Modes
50 Level Mode: Classic MFI implementation where signals occur when MFI crosses above or below the 50 centerline, indicating momentum shifts
MFI MA Mode: Enhanced version where signals occur when MFI crosses its own moving average, providing smoother, filtered entries
🔹 Flexible Moving Average Selection
Choose from six MA types for the MFI MA mode:
EMA (Exponential Moving Average) for responsive signals
SMA (Simple Moving Average) for smoother readings
RMA (Rolling Moving Average) for weighted recent data
WMA (Weighted Moving Average) for customizable weighting
VWMA (Volume-Weighted Moving Average) incorporating volume
HMA (Hull Moving Average) for reduced lag
🔹 Customizable MFI Parameters
Length MFI: Lookback period for MFI calculation (default 14)
Source MFI: Price source for calculations (default Close)
🔹 Volume Integration
Unlike price-only oscillators, MFI incorporates volume, making it particularly effective for identifying genuine buying and selling pressure.
🔹 Customizable Color Themes
Eight distinct color schemes to match your charting preferences:
Classic – Green for bullish, Red for bearish
Modern – White for bullish, Purple for bearish
Robust – Amber for bullish, Maroon for bearish
Accented – Violet for bullish, Pink for bearish
Monochrome – Light gray for bullish, Dark gray for bearish
Moderate – Green for bullish, Red for bearish
Aqua – Blue for bullish, Orange for bearish
Cosmic – Pink for bullish, Purple for bearish
🔹 Comprehensive Visual Feedback
Colored MFI Line: Changes color based on position relative to the reference line
Signal Line: Yellow line showing 50 or MA reference
Gradient Fill Zones: Clear visualization of overbought (above 80) and oversold (below 20) conditions
Dynamic Zone Fills: Semi-transparent fills showing when MFI is above or below the reference line
Color-Coded Candles: Bars reflect current MFI bias (above or below reference)
Signal Markers: Triangle up/down symbols at crossover points
Live Value Display: Current MFI value shown in a floating label
Trend Table: Bullish/Bearish status displayed on the chart
🔹 Ready-to-Use Alerts
Built-in alert conditions trigger LONG signals on bullish crossovers and SHORT signals on bearish crossunders across both operating modes.
⚙️ Settings Summary
Color Choice: Select from eight visual themes (Default: Classic)
Length MFI: Lookback period for MFI calculation (Default: 14)
Source MFI: Price source for calculations (Default: Close)
Entry/Exit Signal: Choose between 50 level or MFI MA mode (Default: 50)
Length MA: Moving average period for MFI MA mode (Default: 365)
MFI MA Type: Moving average method for signal line (Default: EMA)
📈 Practical Applications
🔹 Overbought/Oversold Detection
Traditional MFI usage identifies extreme conditions:
Readings above 80 suggest overbought conditions and potential reversal down
Readings below 20 suggest oversold conditions and potential reversal up
The indicator provides gradient fills in these zones for visual clarity
Volume weighting makes these signals more reliable than RSI alone
🔹 Centerline Crossovers
In 50 Level mode, crossovers provide momentum signals:
Crossover above 50 → Bullish momentum strengthening (buying pressure exceeding selling pressure)
Crossunder below 50 → Bearish momentum strengthening (selling pressure exceeding buying pressure)
🔹 Signal Line Crossovers
In MFI MA mode, crossovers between MFI and its moving average provide filtered signals that reduce whipsaws in ranging markets while maintaining sensitivity in trends.
🔹 Divergence Trading
MFI is excellent for spotting divergences, often more reliable than price-only oscillators due to volume confirmation:
Bullish Divergence: Price makes lower low, MFI makes higher low → Potential upside reversal (weakening selling pressure)
Bearish Divergence: Price makes higher high, MFI makes lower high → Potential downside reversal (weakening buying pressure)
Divergences are most significant when occurring at extreme levels (above 80 or below 20)
🔹 Volume Confirmation
The volume component adds an extra dimension:
MFI rising with price confirms bullish trend (volume supporting the move)
MFI falling while price rises suggests weak buying pressure (potential reversal)
MFI rising while price falls suggests hidden accumulation
🔹 Failure Swings
Look for MFI moves above 80 (or below 20), a pullback, and then a move beyond the previous extreme, confirmed by volume patterns.
🔹 Multiple Timeframe Analysis
Compare MFI readings across different timeframes:
Higher timeframe MFI confirms primary trend direction with volume confirmation
Lower timeframe MFI identifies entry timing and short-term momentum shifts
🎯 Ideal For
✅ Volume-Aware Traders seeking to incorporate volume into momentum analysis
✅ Mean Reversion Traders looking for overbought and oversold opportunities with volume confirmation
✅ Divergence Traders wanting more reliable reversal signals through volume confirmation
✅ Swing Traders capturing medium-term momentum shifts with volume support
✅ System Developers needing volume-weighted momentum signals
✅ Institutional Traders who value volume analysis for confirmation
📌 Key Takeaways
Volume-Weighted Momentum: Unlike RSI, MFI incorporates volume, providing a more complete picture of buying and selling pressure
Dual-Mode Flexibility: Choose between classic 50-level crossovers for traditional signals or MA-smoothed signals for filtered entries
Comprehensive Visualization: Color themes, gradient fills for overbought/oversold zones, candles, and labels provide immediate market awareness
Divergence Capability: Volume-weighted divergences are often more reliable than price-only divergences
Alert-Ready: Built-in alerts for both LONG and SHORT signals across both operating modes
⚠️ Important Notes
MFI, like RSI, can remain in overbought or oversold territory for extended periods during strong trends. The default length of 14 is standard but can be adjusted for different trading styles. The 365-day MA default in MFI MA mode is designed for longer-term trend context on daily charts. Volume spikes can cause sudden MFI movements; consider using smooth volume inputs if available. Divergences are most reliable when they occur at extreme readings. Always combine with proper risk management and additional confirmation for best results.
Disclaimer: This indicator is provided for educational and informational purposes only. Past performance is not indicative of future results. Always conduct thorough testing and align with your risk management strategy before live deployment.
Wskaźnik Pine Script®






















