Open-source scriptindicator/v1
Chaikin Money Flow
Sum close-location volume over a rolling window and normalize it by total volume.
#chaikin#money-flow#volume
Description
Chaikin Money Flow estimates accumulation and distribution across a chosen period. Positive values indicate that closes and volume have favored the upper parts of bar ranges, while negative values indicate greater pressure toward the lower parts.
Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.
Release notes
Version history · 1 published version
Version 1CurrentChart updatedChaikin Money Flow · Aug 31, 2026
Source codempl-2.0View sourceHide source
indicator("Chaikin Money Flow", { overlay: false });
const length = input.int("Length", 20, { min: 1, max: 500 });
const moneyFlowVolume = close.map((c, i) => {
const span = high[i] - low[i];
return span === 0 ? 0 : ((2 * c - high[i] - low[i]) / span) * volume[i];
});
const line = close.map((_, i) => {
if (i < length - 1) return NaN;
let flow = 0;
let totalVolume = 0;
for (let j = i - length + 1; j <= i; j++) {
flow += moneyFlowVolume[j];
totalVolume += volume[j];
}
return totalVolume === 0 ? 0 : flow / totalVolume;
});
plot(line, { title: "CMF", color: "#2962ff", lineWidth: 2 });
hline(0, { title: "Zero", color: "#78909c", style: "dotted" });
Community discussion
0 comments
No comments yet. Start the discussion.