A volume-weighted oscillator that gauges buying versus selling pressure over a set lookback, swinging between +1 and -1 around a zero line.
Chaikin Money Flow (CMF), developed by Marc Chaikin, is a volume-based oscillator that measures the amount of money flow volume over a chosen period, most commonly 20 or 21 bars. It combines price and volume into a single line that oscillates above and below zero, with theoretical bounds of +1 and -1 (values near those extremes are rare in practice). The idea behind it is that where a bar closes within its high-low range, weighted by volume, says something about whether buyers or sellers were more active. CMF is plotted in a separate pane below the price chart. It is an educational tool for studying volume and price together; it is not predictive and does not generate buy or sell signals on its own.
CMF is built in three steps. First, each bar gets a Money Flow Multiplier: ((Close - Low) - (High - Close)) / (High - Low). This ranges from +1 (close at the high) to -1 (close at the low) and tells you where price finished inside the bar's range. Second, that multiplier is scaled by the bar's volume to produce Money Flow Volume, so high-volume bars carry more weight than quiet ones. Third, CMF sums Money Flow Volume over the lookback period (default 20 or 21) and divides by the sum of volume over the same period. The result is a normalized line that floats around zero: readings above zero reflect a period where volume-weighted closes leaned toward the upper part of bar ranges, and readings below zero reflect the opposite. Because it relies on the close's position within each bar's range, CMF can behave oddly on instruments or sessions with gaps, since a gap between bars is not captured inside any single bar's high-low range.
Default length is 20 (some platforms and traders use 21). The lookback is the main parameter; shorter values react faster and noisier, longer values are smoother and slower. Optional zero-line thresholds like +/-0.05 or +/-0.10 are sometimes added to ignore readings hovering near zero.
//@version=6
indicator("Chaikin Money Flow (CMF)", shorttitle="CMF")
length = input.int(20, "Length", minval=1)
// Money Flow Multiplier, guarded against a zero-range bar
mult = (high == low) ? 0.0 : ((close - low) - (high - close)) / (high - low)
mfv = mult * volume
volSum = ta.sum(volume, length)
cmf = volSum == 0 ? na : ta.sum(mfv, length) / volSum
plot(cmf, "CMF", color=color.teal)
hline(0, "Zero", color=color.gray, linestyle=hline.style_dashed)
// Educational tool only. Not a signal or recommendation; trading carries risk of loss.Pro tip: Before trusting CMF, confirm your data feed gives real volume for the instrument and timeframe you are on. On spot forex and some CFDs, volume is often only tick count or synthetic, which can make CMF look authoritative while measuring almost nothing useful.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.