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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.