All indicators

MFI Divergence v2

Jul 15, 2019

Static chart image
Volume BasedSignalsOscillatorsDivergences

The MFI Divergence v2 indicator identifies potential trend reversals by detecting divergences between price action and the Money Flow Index (MFI) while using Stochastic conditions as a secondary trend filter. This tool aims to pinpoint exhausted market moves by highlighting discrepancies where price makes new extremes but the volume-weighted momentum does not, filtered for overbought and oversold environments.

Usage

The Usage section describes how the script can be used to identify market turning points. Traders typically look for the following signals:

  • Bullish Divergence: Appears when price creates a lower low, but the MFI creates a higher low. This is often an indication that selling pressure is weakening.
  • Bearish Divergence: Appears when price creates a higher high, but the MFI creates a lower high. This suggests that buying pressure is fading despite the price increase.
  • Stochastic Filtering: Signals are only displayed when the Stochastic Oscillator is in an overbought (>75) or oversold (<25) state. A common entry strategy is to wait for a divergence signal and then enter once the Stochastic exits the extreme zone (e.g., crossing below 80 for a short or above 20 for a long).

Details

This script is an evolution of standard RSI divergence concepts, adapted specifically for the Money Flow Index (MFI) to incorporate volume into the momentum calculation. Unlike some divergence scripts that offset signals into the past (lagging), version 2 focuses on real-time detection by removing the 1-bar offset found in earlier iterations. The indicator utilizes dynamic lookback periods based on the active timeframe (ranging from 1m to 1W) to ensure that the detected peaks and troughs are relevant to the current chart scale.

Settings

MFI Settings

  • MFI Length: Determines the number of bars used to calculate the Money Flow Index.
  • Overbought: Sets the upper threshold for the Stochastic filter (Default: 75).
  • Oversold: Sets the lower threshold for the Stochastic filter (Default: 25).

Stochastic Settings

  • Stoch period: The period used for the raw Stochastic calculation.
  • Stoch smooth: The smoothing factor applied to the Stochastic %K line.

Display & Lookbacks

  • Hide pivots?: Toggles the visibility of minor pivot points on the chart.
  • Lookback (1m - W): Customizes how many bars the script looks back to find relative highs and lows for each specific timeframe.

FAQ

How do I interpret the triangle shapes?

Triangles above the bars indicate bearish divergence, suggesting a potential downward reversal. Triangles below the bars indicate bullish divergence, suggesting a potential upward reversal.

Why are some signals filtered out?

The indicator only shows divergences that occur while the Stochastic oscillator is in an overbought or oversold region. This reduces "noise" by ensuring signals only appear during extreme market conditions.

How can I access MFI Divergence v2?

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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.