AccumulationDistribution — Accumulation/Distribution
תוכן זה אינו זמין עדיין בשפה שלך.
Chaikin’s cumulative money-flow line: where in its range each bar closed (−1 at the low, +1 at the high) times its volume, accumulated. Like OBV, the level means nothing — the slope and divergences do.
Signature
AccumulationDistribution(period, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
period |
int Param or literal | Yes | SMA smoothing of the line. 1 returns the raw accumulator. Bounds 1–200. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads high, low, close, volume. |
Formula
$$ CLV = \frac{(C - L) - (H - C)}{H - L}, \quad AD_t = AD_{t-1} + CLV \cdot V $$
A bar with no range contributes 0.
Warmup
Starts at 0; accumulates from the first bar. Resets per run and per walk-forward window.
Reading the value
ad.valuead.value > ad.value_at(20)Example
class AdDivergenceGuard(Strategy): """Stay long only while the A/D line confirms the trend.""" trade = Symbol() sizing = FixedCapital()
def execute(self): ad = AccumulationDistribution(1, on=self.trade) sma = SMA(50, on=self.trade) if self.trade.close > sma.value and ad.value > ad.value_at(20) and self.trade.is_flat: self.buy(self.trade, reason="Trend with accumulation") if ad.value < ad.value_at(20) and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Distribution")Notes
- Marc Chaikin’s A/D line.
ChaikinMoneyFlowis the windowed, bounded form — usually the more useful one for a rule.