OPEN-SOURCE SCRIPT
DP_MoneyFlow_Osc_V4

**DP_Moneyflow_Osc_V4** is a custom, volume‐weighted momentum oscillator built around the classic Money Flow Index (MFI), with a few twists to help you spot more reliable reversal points:
***Best way to use it is to take the signals as alert points, to understand when money is starting to flow in or starting to flow out. It is not intended to be a Buy or Sell signal at the point of entry where the label is printed.***
1. **Core Calculation**
* Computes the standard MFI on your chart’s native timeframe:
* Money Flow = typical price (H+L+C)/3 × volume
* Segregates positive vs. negative flow based on whether price rose or fell on each bar
* Smooths each with an N-bar SMA, forms the ratio, and maps it into a 0–100 scale
2. **Inversion & Smoothing**
* You can **invert** the oscillator around 50 (so peaks become troughs and vice versa) with the **Reverse MFI** toggle.
* Applies two layers of smoothing (one for raw noise reduction, another for longer-term trend stability).
3. **Dynamic Coloring**
* Above Overbought (OB) threshold → solid red; below Oversold (OS) → solid green.
* In between, it linearly fades from red/green toward black as it approaches the 50 midpoint.
* **Invert Colors** flips the hue logic (red ↔ green) if you prefer.
4. **Overbought/Oversold Zones**
* Plots horizontal lines at your chosen OB/OS levels.
* Optionally fills the zone between them for quick visual reference.
5. **Peak/Trough Signal Labels**
* Detects **true extremes** by finding when the oscillator reverses direction right at or beyond your OB/OS levels.
* Prints a tiny “OB” or “OS” label **exactly at that pivot bar**, so you see the high or low of the swing.
6. **Alternation Toggle**
* Prevents two consecutive “OS” or “OB” labels by enforcing strict Buy/Sell alternation—turn this on or off via **Enable Signal Alternation**.
---
**Use-Case**: This oscillator excels at pinpointing the *tops* and *bottoms* of strong volume‐backed moves, giving you clear pivot markers rather than every threshold crossover. Tweak the smoothing and threshold inputs to calibrate sensitivity to your market and timeframe.
***Best way to use it is to take the signals as alert points, to understand when money is starting to flow in or starting to flow out. It is not intended to be a Buy or Sell signal at the point of entry where the label is printed.***
1. **Core Calculation**
* Computes the standard MFI on your chart’s native timeframe:
* Money Flow = typical price (H+L+C)/3 × volume
* Segregates positive vs. negative flow based on whether price rose or fell on each bar
* Smooths each with an N-bar SMA, forms the ratio, and maps it into a 0–100 scale
2. **Inversion & Smoothing**
* You can **invert** the oscillator around 50 (so peaks become troughs and vice versa) with the **Reverse MFI** toggle.
* Applies two layers of smoothing (one for raw noise reduction, another for longer-term trend stability).
3. **Dynamic Coloring**
* Above Overbought (OB) threshold → solid red; below Oversold (OS) → solid green.
* In between, it linearly fades from red/green toward black as it approaches the 50 midpoint.
* **Invert Colors** flips the hue logic (red ↔ green) if you prefer.
4. **Overbought/Oversold Zones**
* Plots horizontal lines at your chosen OB/OS levels.
* Optionally fills the zone between them for quick visual reference.
5. **Peak/Trough Signal Labels**
* Detects **true extremes** by finding when the oscillator reverses direction right at or beyond your OB/OS levels.
* Prints a tiny “OB” or “OS” label **exactly at that pivot bar**, so you see the high or low of the swing.
6. **Alternation Toggle**
* Prevents two consecutive “OS” or “OB” labels by enforcing strict Buy/Sell alternation—turn this on or off via **Enable Signal Alternation**.
---
**Use-Case**: This oscillator excels at pinpointing the *tops* and *bottoms* of strong volume‐backed moves, giving you clear pivot markers rather than every threshold crossover. Tweak the smoothing and threshold inputs to calibrate sensitivity to your market and timeframe.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.