Skip to content

Chaikin Money Flow ​

Accumulation over N bars divided by volume, -1 to 1.

Kind indicator · Drawn in its own pane

Try it ​

On the chart, press / and choose Chaikin Money Flow under Volume. To change it, copy the source below into the AlphaScript editor.

Inputs ​

InputTypeDefault
Lengthint20
Colorcolor"#43A047"

Source ​

From packages/alphascript/indicators/cmf.as.js.

js
indicator({ name: "Chaikin Money Flow", shortTitle: "CMF", overlay: false, precision: 3 });
const length = input.int("Length", 20, { min: 1 });
const mfv = ta.calc([candle.high, candle.low, candle.close, candle.volume], (h, l, c, v) => (h - l ? ((2 * c - l - h) / (h - l)) * v : 0));
plot(ta.calc([ta.sum(mfv, length), ta.sum(candle.volume, length)], (m, v) => (v ? m / v : NaN)), { title: "MF", color: input.color("Color", "#43A047", { group: "Style" }) });
hline(0, { title: "Zero", color: "rgba(120,123,134,0.5)", style: "dashed" });

AlphaScript language v0.1 · runtime 0.2.0