On-Balance Volume (OBV) is a cumulative volume-flow indicator: instead of scoring each candle on a fixed scale, it keeps a single running total that only ever adds or subtracts a bar's volume based on which way price closed. Where Money Flow Index blends price and volume into a bounded 0-100 oscillator, OBV does something simpler and, in a way, more direct — it just accumulates volume in the direction of price, forever, and lets you watch whether that running total agrees with what price is doing. That makes it less of a "zone" tool and more of a confirmation tool, which changes how it should be read from the ground up.
How OBV Is Calculated
OBV's formula has no smoothing, no averaging, and no lookback period — it's a straight running total that updates one bar at a time:
- If the current close is higher than the previous close, that bar's volume is added to the running total.
- If the current close is lower than the previous close, that bar's volume is subtracted from the running total.
- If the current close is unchanged, the running total stays exactly where it was.
There's no reset, no ceiling, and no floor — the line simply climbs when up-volume outweighs down-volume over time, and falls when the opposite is true. This is why OBV looks completely different from RSI, MFI, or CCI: those all rescale their output into a fixed band every period, while OBV's absolute value only matters relative to where it was before. A reading of 50,000 or -2 million means nothing on its own; what matters is the shape of the line and whether it's rising, falling, or flattening compared to price.
Reading OBV: Confirmation, Not Zones
Because OBV has no overbought or oversold zone, the way to read it is by comparing its shape to price's shape, not by watching for a threshold to be crossed. The diagram above shows the ideal case: price is climbing in a series of higher highs, and OBV is climbing right alongside it in its own higher highs. That agreement is what a healthy trend looks like on OBV — each new price high is backed by more accumulated buying volume than the last, which tells you real participation is behind the move, not just a handful of lightly-traded prints drifting the price upward.
The opposite case — where price keeps climbing but OBV starts flattening or rolling over — is the single most useful signal OBV produces, and it's the subject of the next section. The core habit to build is: don't look at OBV in isolation, look at OBV next to price, bar for bar, high for high.
Divergence: OBV's Real Power
OBV's real value isn't as a standalone buy or sell trigger — it's as a lie detector for price moves. Divergence between price and OBV is the pattern that makes the indicator worth having on a chart at all.
Bearish divergence happens when price prints a new high, but OBV fails to print a new high alongside it — the cumulative volume line stalls, flattens, or even ticks down while price is still grinding upward. That mismatch is a warning sign: the rally is happening without proportional buying volume behind it, which means fewer participants are actually pushing the move, and it may be more fragile than the price chart alone suggests. It doesn't mean price will reverse immediately — divergence can persist for a while before it resolves — but it's a signal to tighten risk management or look for confirmation elsewhere before assuming the trend has real legs.
Bullish divergence is the mirror image at lows: price makes a new low, but OBV fails to make a new low with it, instead holding above its prior trough. That suggests the selling has run out of real volume behind it — sellers are pushing price down on thinner and thinner participation, which is often what happens right before a bottom forms and buyers step back in.
Neither divergence is a precise entry trigger on its own. Traders generally use it as a heads-up to watch more closely, then wait for price structure itself (a broken swing low, a failed retest, a reversal candle) or another indicator's signal to confirm before acting. Divergence tells you something is off about the volume backing a move; it doesn't tell you exactly when that imbalance will resolve.
Entry Conditions: The Signal-Average Cross
Because OBV has no natural centerline or fixed zone to alert on, the included indicator manufactures one: it computes a simple moving average of OBV itself over a configurable SignalPeriod (20 bars by default), then watches for OBV to cross that average.
- BUY signal — OBV crosses above its own signal average, suggesting the balance of volume has just turned positive relative to its recent trend.
- SELL signal — OBV crosses below its own signal average, suggesting the balance of volume has just turned negative relative to its recent trend.
This signal average isn't a second built-in indicator — it's calculated manually inside the alert code by averaging OBV's own values over the lookback window, precisely because OBV alone has nothing else to cross. Treat this cross the same way you'd treat a MACD signal-line cross: it's a timing tool for momentum shifts in the underlying line, best combined with the divergence read above and with actual price structure, not fired blindly on its own.
Parameters
- AppliedPrice (MT4, default
PRICE_CLOSE) / AppliedVolume (MT5, defaultVOLUME_TICK) — which price series or volume type feeds the OBV calculation. - SignalPeriod (default 20) — the lookback window for the signal moving average that OBV crosses to generate alerts. Shorter periods react faster but produce more whipsaw crosses; longer periods smooth the signal line and fire less often.
- EnableAlert (default true) — pop up a terminal alert the moment OBV crosses its signal average.
- EnablePush (default false) — also send a push notification to your phone via MetaTrader's mobile app.
OBV vs MFI: Two Different Ways to Use Volume
Both OBV and MFI on this site use volume to add a layer beyond what price alone shows, but they're built on genuinely different logic. MFI compresses volume-weighted price action into a bounded 0-100 oscillator with defined Overbought (80) and Oversold (20) zones — you read it the way you'd read RSI, just weighted by money flow. OBV does the opposite: it never resets and never bounds itself, so there's no zone to watch and no fixed threshold that means "extreme." Instead its value comes entirely from shape comparison against price over time.
In practice this makes them complementary rather than redundant. MFI is useful for spotting short-term overbought/oversold extremes the way an oscillator does; OBV is useful for validating whether a longer trend has genuine volume support behind it. A trader might use MFI to time an entry inside an established trend, while checking OBV to confirm that trend is actually backed by real accumulated volume rather than thinning out underneath the price action.
The Forex Volume Caveat
Volume-based indicators carry an extra asterisk on forex charts that's worth restating clearly here, because OBV leans on volume more directly than almost anything else on this site — it is accumulated volume, not a blend. Forex is an over-the-counter market with no central exchange, so there's no single authoritative record of how many units of a currency pair actually changed hands. What MetaTrader supplies instead is tick volume — a count of how many times the quoted price updated during a bar — and that's what feeds this indicator's calculation, not real traded volume (which the MQL5 build's VOLUME_TICK setting makes explicit, since true VOLUME_REAL generally isn't reported for currency pairs at all).
Tick volume tends to correlate reasonably well with genuine trading activity — busier markets do tend to generate more price updates — but it's a proxy, not a direct count, and each broker only sees its own slice of the global market's quote stream. That means the exact shape of your OBV line can differ somewhat from one broker to another for the identical pair and timeframe, even though the underlying price action is the same. None of this makes OBV useless on forex — the confirmation and divergence patterns it reveals still hold up reasonably well in practice — but it's worth remembering you're reading accumulated quoting intensity, not literal traded volume, especially before leaning heavily on a marginal divergence call.
A Word of Caution
OBV's biggest limitation is that it has no absolute scale to sanity-check against — a rising line only tells you volume flow has been net positive since whatever arbitrary starting point the chart began at, so comparisons only make sense within a visible window, not across radically different time spans. It's also possible for OBV to drift for reasons unrelated to a clean trend — a handful of unusually high-volume bars can dominate the running total for a long stretch afterward. As with any tool on this site, use OBV to confirm or question what price and market structure are already telling you (see Trend vs Range for reading that structure first) rather than as an isolated trigger, and always size positions with a defined stop before acting on any signal — see Risk Management Basics for the position-sizing math.
Download the Indicator
This custom indicator calculates On-Balance Volume in a separate window and automatically alerts when OBV crosses its own signal moving average. It's available for both MetaTrader 4 and MetaTrader 5 below.
How to Install — MetaTrader 4
- Download the
obv-alert.mq4file below. - Open MetaTrader 4 → click
File→Open Data Folder. - Place the file in the
MQL4/Indicatorsfolder. - Restart MetaTrader 4, then drag the indicator from the Navigator window onto the chart.
How to Install — MetaTrader 5
- Download the
obv-alert.mq5file below. - Open MetaTrader 5 → click
File→Open Data Folder. - Place the file in the
MQL5/Indicatorsfolder. - Restart MetaTrader 5, then drag the indicator from the Navigator window onto the chart.
Both files are source code — open and review the full code before using it, for your own safety.