OPEN-SOURCE SCRIPT
CTZ Accumulation/Distribution

**CTZ Accumulation/Distribution**
A volume-based indicator that tracks whether money is flowing into or out of an asset by measuring where price closes within each bar's range, weighted by volume.
**How it works**
Each bar, a Money Flow Multiplier is calculated from the close's position between the high and low (–1 to +1). This is multiplied by volume to produce Money Flow Volume, which is added to a running cumulative total — the A/D line. Closes near the high on heavy volume push the line up (accumulation); closes near the low on heavy volume push it down (distribution).
**Features**
- **A/D Line with trend colouring** — teal when above the signal EMA, red when below, giving an at-a-glance read on money flow direction
- **Signal EMA (default 21)** — smooths the A/D line and acts as a trend filter; crosses can be used as early momentum shifts
- **Automatic divergence detection** — pivot-based logic flags bullish divergence (price makes a lower low while A/D makes a higher low = hidden accumulation) and bearish divergence (price makes a higher high while A/D makes a lower high = distribution into strength)
- **Built-in alerts** — divergence signals and signal-line crosses in both directions
**How to use it**
Confirmation: when price and the A/D line rise together, the uptrend is supported by real buying pressure. When they fall together, the downtrend is genuine.
Divergence: when price and the A/D line disagree, treat it as an early warning. Bull labels suggest smart money is accumulating into weakness; Bear labels suggest distribution into rising prices. These work best on higher timeframes and near key levels — not as standalone entries.
**Settings**
Signal EMA length, pivot lookback (sensitivity of divergence detection), and max bars between pivots (how far apart two pivots can be and still count as a divergence) are all adjustable.
**Limitations**
The A/D line ignores gaps between bars — an asset gapping up overnight registers nothing if it then closes mid-range. Pivot-confirmed divergence labels print a few bars after the pivot by design. Best used alongside momentum tools (RSI, MFI) rather than in isolation.
A volume-based indicator that tracks whether money is flowing into or out of an asset by measuring where price closes within each bar's range, weighted by volume.
**How it works**
Each bar, a Money Flow Multiplier is calculated from the close's position between the high and low (–1 to +1). This is multiplied by volume to produce Money Flow Volume, which is added to a running cumulative total — the A/D line. Closes near the high on heavy volume push the line up (accumulation); closes near the low on heavy volume push it down (distribution).
**Features**
- **A/D Line with trend colouring** — teal when above the signal EMA, red when below, giving an at-a-glance read on money flow direction
- **Signal EMA (default 21)** — smooths the A/D line and acts as a trend filter; crosses can be used as early momentum shifts
- **Automatic divergence detection** — pivot-based logic flags bullish divergence (price makes a lower low while A/D makes a higher low = hidden accumulation) and bearish divergence (price makes a higher high while A/D makes a lower high = distribution into strength)
- **Built-in alerts** — divergence signals and signal-line crosses in both directions
**How to use it**
Confirmation: when price and the A/D line rise together, the uptrend is supported by real buying pressure. When they fall together, the downtrend is genuine.
Divergence: when price and the A/D line disagree, treat it as an early warning. Bull labels suggest smart money is accumulating into weakness; Bear labels suggest distribution into rising prices. These work best on higher timeframes and near key levels — not as standalone entries.
**Settings**
Signal EMA length, pivot lookback (sensitivity of divergence detection), and max bars between pivots (how far apart two pivots can be and still count as a divergence) are all adjustable.
**Limitations**
The A/D line ignores gaps between bars — an asset gapping up overnight registers nothing if it then closes mid-range. Pivot-confirmed divergence labels print a few bars after the pivot by design. Best used alongside momentum tools (RSI, MFI) rather than in isolation.
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.