OPEN-SOURCE SCRIPT
Aktualisiert Double Money Flow Index - DMFI | TR

🎯 Overview
Double Money Flow Index - DMFI | TR is an advanced volume‑weighted oscillator developed by Tiagorocha1989 that enhances the classic Money Flow Index (MFI) by applying the MFI formula twice. This “double MFI” approach amplifies shifts in money flow, reduces lag, and helps traders identify accumulation/distribution phases and potential reversals earlier than traditional MFI. With dual‑mode operation (centerline or moving‑average crossovers), an extensive selection of moving average types, and comprehensive visual customization, DMFI provides a powerful tool for volume‑based momentum analysis.
🔧 How It Works
The standard Money Flow Index (MFI) combines price and volume to measure buying and selling pressure, ranging from 0 to 100. Double MFI applies the same logic to the MFI series itself, creating a “momentum of money flow” effect that highlights changes in the underlying MFI’s behaviour.
Core Calculation Logic:
First MFI:
MFI = 100 - (100 / (1 + Money Flow Ratio))
where the period is user‑defined Length MFI and the source is Source MFI.
(MFI internally uses typical price and volume to compute positive and negative money flow.)
Double MFI (DMFI):
DMFI = 2 × MFI - ta.mfi(MFI, Length_MFI)
i.e., the current MFI minus the MFI of MFI (applied to the MFI series) and then doubled, effectively smoothing and amplifying changes in MFI.
Reference Line (Entry_DMFI):
The indicator compares DMFI to a reference line that can be either:
50 Line (classic MFI mode) – the traditional centerline separating bullish ( >50) and bearish ( <50) money flow. Signals occur when DMFI crosses above or below 50.
DMFI MA (enhanced mode) – the reference line becomes a moving average of DMFI itself, providing smoother, filtered signals.
The moving average type and length are fully customizable, with support for 12 different MA variants (see Key Features).
The resulting oscillator oscillates around the chosen reference line:
DMFI above reference → strengthening buying pressure (bullish money flow acceleration)
DMFI below reference → strengthening selling pressure (bearish money flow acceleration)
Magnitude indicates the strength of the acceleration. Values above 80 or below 20 are often considered overbought/oversold in classic MFI, but DMFI is unbounded.
✨ Key Features
🔹 Dual Operating Modes
50 Line Mode: Classic signals when DMFI crosses above or below 50 – simple and intuitive for MFI users.
DMFI MA Mode: Smoother signals when DMFI crosses its own moving average – reduces whipsaws in choppy markets.
🔹 Extensive Moving Average Selection
Choose from 12 MA types for the DMFI MA line, each with its own characteristics:
EMA, SMA, RMA, WMA, VWMA, HMA, DEMA, TEMA, TRIMA, FRAMA, SWMA, T3.
The T3 MA includes an adjustable T3 Factor for fine‑tuning smoothness.
🔹 Customizable MFI Parameters
Length MFI: Lookback period for both MFI calculations (default 14).
Source MFI: Price source for the first MFI (default Close).
(MFI internally uses typical price and volume.)
🔹 Extended Range Visualization
Gradient fills are drawn between DMFI and the reference line, with fixed bounds at 120 and 0. These zones help visualise extreme readings, referencing classic MFI overbought/oversold levels while accommodating DMFI’s unbounded nature.
🔹 Customizable Color Themes
Eight distinct color schemes to match your chart aesthetics:
Classic, Modern, Robust, Accented, Monochrome, Moderate, Aqua, Cosmic
Each theme defines separate colors for bullish and bearish states.
🔹 Comprehensive Visual Feedback
Colored DMFI Line: Changes colour based on its position relative to the reference line.
Signal Line: Yellow line representing the 50 or MA reference.
Gradient Fill Zones: Semi‑transparent fills showing extreme money flow areas (overbought/oversold zones).
Dynamic Zone Fills: Additional fill between DMFI and the reference line, coloured by the prevailing bias.
Color‑Coded Candles: Bars reflect the current DMFI bias (above or below reference).
Signal Markers: Triangle up/down symbols at crossover points.
Live Value Display: Current DMFI value shown in a floating label near the last bar.
Trend Table: Bullish/Bearish status displayed in a table on the chart.
🔹 Ready‑to‑Use Alerts
Built‑in alert conditions trigger LONG on bullish crossovers and SHORT on bearish crossunders, for both operating modes.
⚙️ Settings Summary
Setting Description Default
Color Choice Select from eight visual themes Classic
Length MFI Lookback period for both MFI calculations 14
Source MFI Price source for the first MFI Close
Entry/Exit Signal Choose between 50‑line or DMFI MA mode 50
Length MA Moving average period for DMFI MA mode 365
Moving Average Type of moving average for the signal line (12 options) EMA
T3 Factor Factor for T3 moving average (0–1) 0.7
📈 Practical Applications
🔹 Money Flow Acceleration Detection
The slope and position of DMFI relative to the reference line quickly reveal whether money flow is accelerating or decelerating. Steeply rising DMFI indicates strengthening buying pressure; steeply falling DMFI signals strengthening selling pressure.
🔹 50‑Line Crossovers
In 50 Line mode, crossovers provide clear signals:
Crossover above 50 → shift from bearish to bullish money flow, potential trend reversal up.
Crossunder below 50 → shift from bullish to bearish money flow, potential trend reversal down.
🔹 Signal‑Line Crossovers
In DMFI MA mode, crossovers between DMFI and its moving average generate filtered signals:
DMFI crosses above its MA → bullish signal (buying pressure accelerating).
DMFI crosses below its MA → bearish signal (selling pressure accelerating).
These signals work well in trending markets by reducing false entries.
🔹 Overbought / Oversold Conditions
Although DMFI is unbounded, traditional MFI levels (e.g., 80/20) can be referenced. Extreme DMFI readings (above 120 or below 0) often coincide with strong money flow and may precede reversals or pullbacks, especially when combined with divergences.
🔹 Divergence Trading
Double MFI is excellent for spotting divergences with price:
Bullish Divergence: Price makes a lower low while DMFI forms a higher low → possible upside reversal (accumulation).
Bearish Divergence: Price makes a higher high while DMFI forms a lower high → possible downside reversal (distribution).
Divergences are most reliable after extended trends or when DMFI is at extreme levels.
🔹 Money Flow Confirmation
The magnitude of DMFI confirms the strength of money flow:
Large positive values (well above reference) → strong buying pressure.
Large negative values (well below reference) → strong selling pressure.
Values nearing the reference line → money flow slowing, potential trend change.
🔹 Centerline Rejections
When DMFI approaches the reference line (50 or MA) but reverses before crossing, it can signal continuation of the current money flow trend – a common pattern in strong trends.
🔹 Multiple Timeframe Analysis
Compare DMFI readings across timeframes: higher‑timeframe DMFI defines the primary money flow trend, while lower‑timeframe DMFI helps pinpoint entry and exit timing.
🎯 Ideal For
✅ MFI Enthusiasts looking for a more responsive, smoothed version of the classic volume‑weighted indicator.
✅ Volume‑Based Traders wanting to measure buying/selling pressure acceleration.
✅ Trend Traders seeking confirmation of trend strength and direction with volume.
✅ Momentum Traders wanting an early view of money flow shifts.
✅ Divergence Traders looking for leading reversal signals in price/volume relationships.
✅ Swing Traders capturing medium‑term money flow shifts.
✅ System Developers needing a robust, customisable crossover‑based strategy.
✅ Beginner Traders who appreciate clear visual signals and multiple learning modes.
📌 Key Takeaways
Double MFI Logic: Applying the MFI formula twice amplifies money flow signals and reduces lag compared to standard MFI.
Dual‑Mode Flexibility: Choose 50‑line simplicity for classic MFI entries or MA‑smoothed signals for filtered trades.
Unbounded Nature: DMFI has no fixed upper/lower limits; traditional levels (e.g., 80/20, 120/0) serve as useful reference zones.
Volume Integration: Because MFI incorporates volume, DMFI provides a unique volume‑weighted perspective on momentum.
Extensive MA Options: 12 moving average types give you complete control over the smoothness and responsiveness of the signal line.
Rich Visuals: Colour themes, gradient fills for extreme zones, candle colouring, and live value labels provide immediate market context.
Divergence Capability: The double calculation often reveals divergences earlier than simple MFI.
Alert‑Ready: Pre‑built alerts for both LONG and SHORT signals based on crossovers.
⚠️ Important Notes
Because DMFI is unbounded, its scale can vary significantly between instruments and timeframes. The gradient fills at 120 and 0 are arbitrary reference points derived from classic MFI overbought/oversold levels; they may not represent actual extreme conditions for all instruments.
The default Length MFI of 14 is the standard MFI period, offering a balanced perspective. Shorter lengths (e.g., 9) produce more responsive signals, while longer lengths (e.g., 21) smooth out noise.
The default Length MA of 365 in DMFI MA mode is designed for a long‑term context on daily charts; adjust it to match your trading horizon.
Divergences are most reliable when they occur after extended trends and are confirmed by other tools.
Always combine Double MFI with proper risk management and additional confirmation before live deployment.
Disclaimer: This indicator is provided for educational and informational purposes only. Past performance does not guarantee future results. Always test thoroughly and align with your personal risk management strategy.
Double Money Flow Index - DMFI | TR is an advanced volume‑weighted oscillator developed by Tiagorocha1989 that enhances the classic Money Flow Index (MFI) by applying the MFI formula twice. This “double MFI” approach amplifies shifts in money flow, reduces lag, and helps traders identify accumulation/distribution phases and potential reversals earlier than traditional MFI. With dual‑mode operation (centerline or moving‑average crossovers), an extensive selection of moving average types, and comprehensive visual customization, DMFI provides a powerful tool for volume‑based momentum analysis.
🔧 How It Works
The standard Money Flow Index (MFI) combines price and volume to measure buying and selling pressure, ranging from 0 to 100. Double MFI applies the same logic to the MFI series itself, creating a “momentum of money flow” effect that highlights changes in the underlying MFI’s behaviour.
Core Calculation Logic:
First MFI:
MFI = 100 - (100 / (1 + Money Flow Ratio))
where the period is user‑defined Length MFI and the source is Source MFI.
(MFI internally uses typical price and volume to compute positive and negative money flow.)
Double MFI (DMFI):
DMFI = 2 × MFI - ta.mfi(MFI, Length_MFI)
i.e., the current MFI minus the MFI of MFI (applied to the MFI series) and then doubled, effectively smoothing and amplifying changes in MFI.
Reference Line (Entry_DMFI):
The indicator compares DMFI to a reference line that can be either:
50 Line (classic MFI mode) – the traditional centerline separating bullish ( >50) and bearish ( <50) money flow. Signals occur when DMFI crosses above or below 50.
DMFI MA (enhanced mode) – the reference line becomes a moving average of DMFI itself, providing smoother, filtered signals.
The moving average type and length are fully customizable, with support for 12 different MA variants (see Key Features).
The resulting oscillator oscillates around the chosen reference line:
DMFI above reference → strengthening buying pressure (bullish money flow acceleration)
DMFI below reference → strengthening selling pressure (bearish money flow acceleration)
Magnitude indicates the strength of the acceleration. Values above 80 or below 20 are often considered overbought/oversold in classic MFI, but DMFI is unbounded.
✨ Key Features
🔹 Dual Operating Modes
50 Line Mode: Classic signals when DMFI crosses above or below 50 – simple and intuitive for MFI users.
DMFI MA Mode: Smoother signals when DMFI crosses its own moving average – reduces whipsaws in choppy markets.
🔹 Extensive Moving Average Selection
Choose from 12 MA types for the DMFI MA line, each with its own characteristics:
EMA, SMA, RMA, WMA, VWMA, HMA, DEMA, TEMA, TRIMA, FRAMA, SWMA, T3.
The T3 MA includes an adjustable T3 Factor for fine‑tuning smoothness.
🔹 Customizable MFI Parameters
Length MFI: Lookback period for both MFI calculations (default 14).
Source MFI: Price source for the first MFI (default Close).
(MFI internally uses typical price and volume.)
🔹 Extended Range Visualization
Gradient fills are drawn between DMFI and the reference line, with fixed bounds at 120 and 0. These zones help visualise extreme readings, referencing classic MFI overbought/oversold levels while accommodating DMFI’s unbounded nature.
🔹 Customizable Color Themes
Eight distinct color schemes to match your chart aesthetics:
Classic, Modern, Robust, Accented, Monochrome, Moderate, Aqua, Cosmic
Each theme defines separate colors for bullish and bearish states.
🔹 Comprehensive Visual Feedback
Colored DMFI Line: Changes colour based on its position relative to the reference line.
Signal Line: Yellow line representing the 50 or MA reference.
Gradient Fill Zones: Semi‑transparent fills showing extreme money flow areas (overbought/oversold zones).
Dynamic Zone Fills: Additional fill between DMFI and the reference line, coloured by the prevailing bias.
Color‑Coded Candles: Bars reflect the current DMFI bias (above or below reference).
Signal Markers: Triangle up/down symbols at crossover points.
Live Value Display: Current DMFI value shown in a floating label near the last bar.
Trend Table: Bullish/Bearish status displayed in a table on the chart.
🔹 Ready‑to‑Use Alerts
Built‑in alert conditions trigger LONG on bullish crossovers and SHORT on bearish crossunders, for both operating modes.
⚙️ Settings Summary
Setting Description Default
Color Choice Select from eight visual themes Classic
Length MFI Lookback period for both MFI calculations 14
Source MFI Price source for the first MFI Close
Entry/Exit Signal Choose between 50‑line or DMFI MA mode 50
Length MA Moving average period for DMFI MA mode 365
Moving Average Type of moving average for the signal line (12 options) EMA
T3 Factor Factor for T3 moving average (0–1) 0.7
📈 Practical Applications
🔹 Money Flow Acceleration Detection
The slope and position of DMFI relative to the reference line quickly reveal whether money flow is accelerating or decelerating. Steeply rising DMFI indicates strengthening buying pressure; steeply falling DMFI signals strengthening selling pressure.
🔹 50‑Line Crossovers
In 50 Line mode, crossovers provide clear signals:
Crossover above 50 → shift from bearish to bullish money flow, potential trend reversal up.
Crossunder below 50 → shift from bullish to bearish money flow, potential trend reversal down.
🔹 Signal‑Line Crossovers
In DMFI MA mode, crossovers between DMFI and its moving average generate filtered signals:
DMFI crosses above its MA → bullish signal (buying pressure accelerating).
DMFI crosses below its MA → bearish signal (selling pressure accelerating).
These signals work well in trending markets by reducing false entries.
🔹 Overbought / Oversold Conditions
Although DMFI is unbounded, traditional MFI levels (e.g., 80/20) can be referenced. Extreme DMFI readings (above 120 or below 0) often coincide with strong money flow and may precede reversals or pullbacks, especially when combined with divergences.
🔹 Divergence Trading
Double MFI is excellent for spotting divergences with price:
Bullish Divergence: Price makes a lower low while DMFI forms a higher low → possible upside reversal (accumulation).
Bearish Divergence: Price makes a higher high while DMFI forms a lower high → possible downside reversal (distribution).
Divergences are most reliable after extended trends or when DMFI is at extreme levels.
🔹 Money Flow Confirmation
The magnitude of DMFI confirms the strength of money flow:
Large positive values (well above reference) → strong buying pressure.
Large negative values (well below reference) → strong selling pressure.
Values nearing the reference line → money flow slowing, potential trend change.
🔹 Centerline Rejections
When DMFI approaches the reference line (50 or MA) but reverses before crossing, it can signal continuation of the current money flow trend – a common pattern in strong trends.
🔹 Multiple Timeframe Analysis
Compare DMFI readings across timeframes: higher‑timeframe DMFI defines the primary money flow trend, while lower‑timeframe DMFI helps pinpoint entry and exit timing.
🎯 Ideal For
✅ MFI Enthusiasts looking for a more responsive, smoothed version of the classic volume‑weighted indicator.
✅ Volume‑Based Traders wanting to measure buying/selling pressure acceleration.
✅ Trend Traders seeking confirmation of trend strength and direction with volume.
✅ Momentum Traders wanting an early view of money flow shifts.
✅ Divergence Traders looking for leading reversal signals in price/volume relationships.
✅ Swing Traders capturing medium‑term money flow shifts.
✅ System Developers needing a robust, customisable crossover‑based strategy.
✅ Beginner Traders who appreciate clear visual signals and multiple learning modes.
📌 Key Takeaways
Double MFI Logic: Applying the MFI formula twice amplifies money flow signals and reduces lag compared to standard MFI.
Dual‑Mode Flexibility: Choose 50‑line simplicity for classic MFI entries or MA‑smoothed signals for filtered trades.
Unbounded Nature: DMFI has no fixed upper/lower limits; traditional levels (e.g., 80/20, 120/0) serve as useful reference zones.
Volume Integration: Because MFI incorporates volume, DMFI provides a unique volume‑weighted perspective on momentum.
Extensive MA Options: 12 moving average types give you complete control over the smoothness and responsiveness of the signal line.
Rich Visuals: Colour themes, gradient fills for extreme zones, candle colouring, and live value labels provide immediate market context.
Divergence Capability: The double calculation often reveals divergences earlier than simple MFI.
Alert‑Ready: Pre‑built alerts for both LONG and SHORT signals based on crossovers.
⚠️ Important Notes
Because DMFI is unbounded, its scale can vary significantly between instruments and timeframes. The gradient fills at 120 and 0 are arbitrary reference points derived from classic MFI overbought/oversold levels; they may not represent actual extreme conditions for all instruments.
The default Length MFI of 14 is the standard MFI period, offering a balanced perspective. Shorter lengths (e.g., 9) produce more responsive signals, while longer lengths (e.g., 21) smooth out noise.
The default Length MA of 365 in DMFI MA mode is designed for a long‑term context on daily charts; adjust it to match your trading horizon.
Divergences are most reliable when they occur after extended trends and are confirmed by other tools.
Always combine Double MFI with proper risk management and additional confirmation before live deployment.
Disclaimer: This indicator is provided for educational and informational purposes only. Past performance does not guarantee future results. Always test thoroughly and align with your personal risk management strategy.
Versionshinweise
Resolution Previous ProblemVersionshinweise
Color Mode – Added 'Heat' option ([#ff0000, #87cefb]).Dynamic Fill Transparency – Calculates Momentum and Norm_Momentum to set a variable transparency (Fill_Transp) for the overbought/oversold fills, replacing the fixed 0/100 values.
Gradient Candle Colors – Computes a normalized and uses color.from_gradient() to color candles with a smooth transition between down and up colors.
Persistent Trend State – Introduces Trend_ (1 for bull, -1 for bear) that holds the trend direction, used in:
The third fill() (now based on Trend_ instead of a direct.
bgcolor() (now uses Trend_ instead of isBull_/isBear_).
The table and label (display and color based on Trend_).
Label Color – Simplified to use Trend_ colors without transparency.
Versionshinweise
Color Mode – Added 'Heat' option ([#ff0000, #87cefb]).Dynamic Fill Transparency – Calculates Momentum and Norm_Momentum to set a variable transparency (Fill_Transp) for the overbought/oversold fills, replacing the fixed 0/100 values.
Gradient Candle Colors – Computes a normalized and uses color.from_gradient() to color candles with a smooth transition between down and up colors.
Persistent Trend State – Introduces Trend_ (1 for bull, -1 for bear) that holds the trend direction, used in:
The third fill() (now based on Trend_ instead of a direct.
bgcolor() (now uses Trend_ instead of isBull_/isBear_).
The table and label (display and color based on Trend_).
Label Color – Simplified to use Trend_ colors without transparency.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.