What it does

Measures accumulation versus distribution by weighting each bar’s close location within its range by the final aggregate total, then plotting that pressure as either a rolling-sum CMF line or an EMA-based Twiggs Money Flow line with a signal and percentile bands.

Calculations

1. Compute Close Location Value as ((Close – Low) – (High – Close)) / the protected chart range on valid, non-flat bars.
2. Multiply that value by the final aggregate total to create money flow volume.
3. If Flow Method = CMF, calculate the raw line as Sum(MFV, Length) / Sum(total, Length).
4. If Flow Method = Twiggs, calculate the raw line as EMA(MFV, Length) / EMA(total, Length).
5. Apply an EMA to the raw line for the signal, then build the upper and lower bands from rolling percentiles of that same raw line.

Unique story it tells

It measures whether volume pressure is being concentrated into closes near the upper part of the bar range or the lower part of the bar range, which shows whether accumulation or distribution is dominating.

How it identifies tops/bottoms

It does not include a built-in top/bottom trigger or reversal label. Instead, it frames relative extremes with a zero line and rolling percentile bands, so possible tops are usually read when the raw line is stretched into the upper band and starts weakening, while possible bottoms are usually read when it is stretched into the lower band and starts stabilizing or rising.

Story it tells when indicator is rising

Rising means money flow pressure is improving, with more weight being assigned to closes near the upper part of the range, which points to strengthening accumulation.

Story it tells when indicator is falling

Falling means money flow pressure is weakening, with more weight being assigned to closes near the lower part of the range, which points to strengthening distribution.

Story it tells when indicator is neutral

Neutral usually means the line is hovering near zero and not pressing its relative percentile extremes, which suggests buying and selling pressure are broadly balanced.

What it means when indicator is rising + price is rising

Bullish confirmation: price is advancing and money flow pressure is also improving, so the move is being supported by accumulation.

What it means when indicator is rising + price is falling

Possible bullish divergence or hidden accumulation: price is weakening, but money flow pressure is improving underneath the surface.

What it means when indicator is falling + price is rising

Possible bearish divergence: price is advancing while money flow pressure is deteriorating, which can suggest distribution into strength.

What it means when indicator is falling + price is falling

Bearish confirmation: price is declining and money flow pressure is also weakening, so distribution is reinforcing the downside move.

Unique features and settings

Adjustable settings
Market Type — limits the calculation to Spot, Perps, or Both.
Mode — builds the input using Base Units or USD Turnover before the money-flow math is applied.
Length — sets the lookback length used by the selected money-flow method.
Flow Method — switches the main line between rolling-sum CMF and EMA-based Twiggs Money Flow.
Percentile Lookback — sets the rolling window used to build the percentile bands around the raw line.
Lower Percentile — sets the percentile used for the lower band.
Upper Percentile — sets the percentile used for the upper band.
Signal EMA Length — sets the EMA length used for the signal line.
Show Debug Table — displays the full per-venue audit table for the active routed asset.
Font Size — changes the debug table text size.
Location — moves the debug table on the chart.

Hardcoded settings
Final launch venue map — uses the suite’s finalized routed spot and perpetual venue lists as the aggregate source.
Spot/perp interpretation metadata — defines whether each venue contributes as Base, Quote, or Contracts.
Contract mode metadata — defines how contract-based rows convert before they enter the aggregate.
Contract Sizes — apply stored multipliers to perpetual rows that use contract counts.
Data-defense behavior — keeps venue-ignore protection enabled when repeated bad data appears.
Bad-bar threshold — removes a venue’s used contribution after 5 consecutive bad bars.
BASE_ONLY enforcement — forces Base Units internally on supported non-USD or index-like charts.
FALLBACK behavior — switches to the chart’s own volume on unsupported-base charts.
Market-type total-selection — uses explicit Spot / Perps / Both logic to choose the active total.
Debug fetch behavior — may widen active routed fetch scope to show the full venue map, while still reusing each venue fetch once and keeping Used and % Share honest.
Money-flow source — always builds CLV from the chart bar’s high, low, and close.
Range protection — uses a protected chart-range denominator on valid bars; flat-range bars do not enter the CMF/TMF money-flow calculation.
Signal type — always builds the signal line as an EMA of the raw money-flow line.
Band basis — always builds the envelope from rolling percentiles of the raw money-flow line.
Percentile input safety — internally orders the lower and upper percentile inputs before building the bands.

Notes specific to this script

This script has no shared Moving Average section, because its smoothing and confirmation controls are indicator-specific. The main line can run as either rolling-sum CMF or EMA-based Twiggs Money Flow, and the signal is always an EMA of that raw money-flow line. The percentile bands are also built from the raw money-flow line, not from the signal, and the lower and upper percentile inputs are internally reordered so the band still forms correctly if they are entered in reverse. The CMF rolling-sum path waits for a full valid Length window, while the Twiggs path, signal, and percentile bands remain unavailable until their required valid source values exist. In BASE_ONLY and FALLBACK contexts, the script forces Base Units internally, and when debug is enabled it may widen the active routed fetch scope so the full venue map can be shown without letting excluded or ignored rows affect the active total.