OPEN-SOURCE SCRIPT

CTZ Accumulation/Distribution

158
**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.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.