MFI Divergences
Jan 22, 2020

The MFI Divergences indicator tracks volume-weighted momentum and automatically identifies potential trend reversals or continuations by detecting regular and hidden divergences. By combining price action with the Money Flow Index (MFI), this tool helps traders visualize where price and volume-driven momentum are decoupling.
Usage
The Usage section focuses on identifying price reversals and trend strength through the four types of divergences supported by the script:
- Regular Bullish Divergence: Occurs when price makes a lower low, but the MFI makes a higher low. This suggests selling pressure is waning despite lower prices.
- Regular Bearish Divergence: Occurs when price makes a higher high, but the MFI makes a lower high. This suggests buying momentum is slowing down.
- Hidden Bullish Divergence: Occurs when price makes a higher low, but the MFI makes a lower low. This often signals trend continuation for an uptrend.
- Hidden Bearish Divergence: Occurs when price makes a lower high, but the MFI makes a higher high. This often signals trend continuation for a downtrend.
Users can toggle these divergence types on or off in the settings to clean up the chart or focus on specific trading strategies.
Details
The script calculates the Money Flow Index by evaluating the ratio of positive money flow to negative money flow over a specified period. Unlike the standard RSI, MFI incorporates volume, providing a "volume-weighted RSI" perspective.
The divergence logic utilizes pivot points (highs and lows) determined by lookback settings. Once a pivot is confirmed, the script checks if the relationship between the current pivot and the previous pivot in the MFI matches the inverse relationship in price action within a defined bar range.
Settings
- Money Flow Period: The number of bars used to calculate the Money Flow Index (default is 14).
- Money Flow Source: The price source used for calculations (default is Close).
- Pivot Lookback Right: The number of bars to the right of a peak or trough required to confirm a pivot point.
- Pivot Lookback Left: The number of bars to the left of a peak or trough required to confirm a pivot point.
- Max of Lookback Range: The maximum number of bars to look back when searching for a previous pivot to compare for divergence.
- Min of Lookback Range: The minimum number of bars required between pivots to qualify for a divergence.
- Plot Bullish/Bearish: Toggles for displaying regular bullish and bearish divergence labels and lines.
- Plot Hidden Bullish/Bearish: Toggles for displaying hidden bullish and bearish divergence labels and lines.
FAQ
How do I use the MFI Divergences indicator?
You can use the identified labels to spot potential market exhaustion or trend continuation. Bullish labels suggest upward pressure, while Bearish labels suggest downward pressure.
What is the difference between regular and hidden divergence?
Regular divergences typically signal a potential trend reversal, while hidden divergences typically signal that the current trend is likely to continue.
How can I access this tool?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.