accumulationDistribution is a running level; this is the same
per-bar pressure expressed as a bounded, comparable reading — a
volume-weighted mean of clvValues, so it lies in [−1, +1] on any
instrument at any price whose closes sit inside their bars (a close
redirected at a smoothed column can read outside, honestly — the kernel
does not clamp). Above zero is net accumulation over the window,
below zero net distribution; ±0.25 or so is the conventional strong
reading. Appends one column, undefined for the first period − 1 rows.
It is a weighted mean, and says so
The loop is rollingWeightedMeanValues — the kernel vwap
runs on, with the close location for values and volume for weights
instead of typical price and volume. That is not a coincidence to be
exploited: it is what CMF is, Σ x·w / Σ w, and reusing the kernel is
what makes its edge rules the same rules VWAP already documents (below)
rather than a second set to learn.
Definition, verified
TA-Lib has no CMF, so the oracle is a pandas replication at
period 20 and 5, with the analytic first valid bar (period − 1)
asserted and the result separated from the unweighted mean of CLV over
the same window — so a study that dropped the volume weighting could not
pass. Chaikin's own default is 20 bars (21 in some publications; 20 is
ChartIQ's and StockCharts').
Edges
Zero volume over the whole window → undefined. There is nothing to
weight by, so there is no answer — not 0, and not the plain mean of
CLV. (0 / 0 in the kernel, which needs no guard; see
rollingWeightedMeanValues.)
A flat bar (high === low) contributes 0 to the numerator and its
volume to the denominator, pulling the reading toward zero by however
much traded in a bar that reported no direction. That is the
conventional CMF (ChartIQ and StockCharts agree; TA-Lib has none) and it
follows from clvValues' flat-bar value being exactly 0, the
same rule accumulationDistribution runs on.
A gap in any input behaves the same way and recovers once it leaves
the window. As with every count-window study the window is emitted once
it spans periodrows, computed from whichever are present.
Invariant under scaling volume and under any affine change of price
— it is a weighted mean of a ratio, bounded either way. Both pinned by
property tests, and the bound |CMF| ≤ 1 with them.
Chaikin Money Flow — the Accumulation/Distribution term averaged over a window instead of accumulated forever:
accumulationDistribution is a running level; this is the same per-bar pressure expressed as a bounded, comparable reading — a volume-weighted mean of clvValues, so it lies in
[−1, +1]on any instrument at any price whose closes sit inside their bars (acloseredirected at a smoothed column can read outside, honestly — the kernel does not clamp). Above zero is net accumulation over the window, below zero net distribution; ±0.25 or so is the conventional strong reading. Appends one column,undefinedfor the firstperiod − 1rows.It is a weighted mean, and says so
The loop is rollingWeightedMeanValues — the kernel vwap runs on, with the close location for values and volume for weights instead of typical price and volume. That is not a coincidence to be exploited: it is what CMF is,
Σ x·w / Σ w, and reusing the kernel is what makes its edge rules the same rules VWAP already documents (below) rather than a second set to learn.Definition, verified
TA-Lib has no CMF, so the oracle is a pandas replication at
period20 and 5, with the analytic first valid bar (period − 1) asserted and the result separated from the unweighted mean of CLV over the same window — so a study that dropped the volume weighting could not pass. Chaikin's own default is 20 bars (21 in some publications; 20 is ChartIQ's and StockCharts').Edges
undefined. There is nothing to weight by, so there is no answer — not0, and not the plain mean of CLV. (0 / 0in the kernel, which needs no guard; see rollingWeightedMeanValues.)high === low) contributes0to the numerator and its volume to the denominator, pulling the reading toward zero by however much traded in a bar that reported no direction. That is the conventional CMF (ChartIQ and StockCharts agree; TA-Lib has none) and it follows from clvValues' flat-bar value being exactly0, the same rule accumulationDistribution runs on.periodrows, computed from whichever are present.|CMF| ≤ 1with them.