What it does
Adds the final aggregate total when the chart closes above the prior close, subtracts it when the chart closes below the prior close, and carries that signed flow forward as a cumulative On-Balance Volume line.
Calculations
1) Compare the current close to the prior close to assign direction as +1, -1, or 0.
2) Multiply that direction by the final aggregate total to create the OBV step.
3) Add the current OBV step to the prior OBV value to maintain the cumulative line.
4) Apply the selected moving average to the finished OBV line as a separate overlay.
Unique story it tells
It measures whether aggregate volume is cumulatively confirming higher closes or lower closes, which makes it useful for tracking whether directional pressure is building over time.
How it identifies tops/bottoms
It does not include built-in top/bottom markers, thresholds, or reversal labels. Tops and bottoms are usually read through divergence and confirmation, such as price pushing higher while OBV stops confirming, or price pushing lower while OBV starts improving.
Story it tells when indicator is rising
Rising means positive directional volume pressure is accumulating, because more total is being added on up-close bars than subtracted on down-close bars.
Story it tells when indicator is falling
Falling means negative directional volume pressure is accumulating, because more total is being subtracted on down-close bars than added on up-close bars.
Story it tells when indicator is neutral
Neutral usually means the line is flattening because directional pressure is balanced. It can also happen when closes are unchanged, since those bars contribute a zero OBV step.
What it means when indicator is rising + price is rising
Bullish confirmation: price is advancing and cumulative directional volume pressure is also improving.
What it means when indicator is rising + price is falling
Possible bullish divergence or hidden accumulation: price is weakening, but cumulative directional volume pressure is improving underneath the surface.
What it means when indicator is falling + price is rising
Possible bearish divergence: price is advancing while cumulative directional volume pressure is deteriorating.
What it means when indicator is falling + price is falling
Bearish confirmation: price is declining and cumulative directional volume pressure is also worsening.
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 OBV math is applied.
MA Type — selects the overlay moving average type for the OBV line.
MA Length — sets the overlay moving average length.
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.
Direction source — always uses the chart close versus the prior close to set bar direction.
Unchanged-close rule — applies a zero OBV step when the close is unchanged.
Signed-step construction — always multiplies bar direction by the final aggregate total.
Cumulative construction — always accumulates the signed OBV step forward bar to bar.
MA attachment rule — applies the moving average to the final OBV line only.
Notes specific to this script
This script has no indicator-specific settings section beyond the shared Market Type, Mode, Moving Average, and Debug controls. It uses close-to-close direction only, so it does not care where the close finished inside the bar range. The OBV line begins only after both the current close, prior close, and an active routed or fallback total are valid; unavailable history is not synthetic-backfilled, and cumulative OBV starts at the first valid step.

