ChaikinOscillator — Chaikin Oscillator
A MACD built on the accumulation/distribution line instead of price: fast minus slow EMA of A/D. It reads money-flow momentum rather than level, which fixes the main weakness of the raw A/D line — that its absolute value means nothing.
Signature
ChaikinOscillator(fast, slow, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
fast |
int Param or literal | Yes | Fast EMA of A/D. Default 3, bounds 1–200. |
slow |
int Param or literal | Yes | Slow EMA of A/D. Default 10, bounds 2–400. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads high, low, close, volume. |
Formula
$$ \text{ChaikinOsc} = \text{EMA}(AD, f) - \text{EMA}(AD, s) $$
Warmup
Both EMAs seed from the first A/D value; converges over roughly 3 × slow bars.
Reading the value
co.valueco.crossed_above(0)Example
class ChaikinMomentum(Strategy): """Zero-line cross of money-flow momentum.""" trade = Symbol() sizing = FixedCapital()
def execute(self): co = ChaikinOscillator(3, 10, on=self.trade) if co.crossed_above(0) and self.trade.is_flat: self.buy(self.trade, reason="Money flow turning up") if co.crossed_below(0) and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Money flow turning down")Notes
- Marc Chaikin’s oscillator on his own A/D line.