Skip to content
Open RaamTrade

ChaikinMoneyFlow — Chaikin Money Flow

The A/D idea over a window instead of forever: close-location value times volume, summed over n bars and scaled by total volume. Bounded −1 to +1 and drift-free, which makes it the form you can actually write a rule against.

Signature

ChaikinMoneyFlow(period, on=<source>)
Argument Type Required Notes
period int Param or literal Yes Window. Default 20 (Chaikin’s 21 also common). Bounds 1–400.
on= symbol No Source symbol. Defaults to the trade symbol. Reads high, low, close, volume.

Formula

$$ \text{CMF} = \frac{\sum_n CLV_i \cdot V_i}{\sum_n V_i}, \quad CLV = \frac{(C-L)-(H-C)}{H-L} $$

Warmup

period bars to a full window (partial sums before); 0 when the window’s volume is zero.

Reading the value

cmf.value
cmf > 0.1
cmf.crossed_below(0)

Example

class CmfFilter(Strategy):
"""Trend entries gated on positive money flow."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
cmf = ChaikinMoneyFlow(20, on=self.trade)
sma = SMA(50, on=self.trade)
if self.trade.close > sma.value and cmf.value > 0.1 and self.trade.is_flat:
self.buy(self.trade, reason=f"CMF {cmf.value:.2f}")
if cmf.value < 0 and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Money flow negative")

Notes

  • Marc Chaikin.
  • Zero-range bars contribute zero flow but their volume still enters the denominator — the standard convention.