The Money Flow Index (MFI) is a momentum oscillator that measures the strength of money flowing into and out of a security. Developed as a "volume-weighted RSI," it combines both price and volume data to identify overbought or oversold conditions.
Our `MFI_Pro` implementation is a unified, professional version that includes an **optional signal line** and allows the calculation to be based on either **standard** or **Heikin Ashi** price data.
- **Composition:** The calculator internally uses our universal `MovingAverage_Engine.mqh` to handle the smoothing of the Signal Line. This allows for advanced smoothing types (like DEMA or TEMA) beyond the standard SMA.
- A base class, `CMFICalculator`, handles the core MFI algorithm.
- A derived class, `CMFICalculator_HA`, inherits from the base class and overrides the data preparation step to use the Typical Price derived from smoothed Heikin Ashi candles.
- **Overbought/Oversold Levels:** The primary use of the MFI is to identify extreme conditions (typically above 80 and below 20).
- **Divergence:** This is the MFI's most powerful signal. A bullish divergence occurs when price makes a lower low, but the MFI makes a higher low. A bearish divergence is the opposite.
- **Signal Line Crossovers:** If the signal line is enabled, crossovers can provide entry and exit signals, similar to other oscillators.
- **Caution:** In a very strong trend, the MFI can remain in overbought or oversold territory for extended periods.