OBV Divergence Strategy: How to Build It in Arrow Algo

OBV Divergence Strategy: How to Build It in Arrow Algo

An OBV divergence strategy hunts for the moments when volume stops agreeing with price. On-Balance Volume, created by Joe Granville in 1963, runs on a famous premise: volume precedes price. When price grinds to a new high but OBV refuses to follow, the buyers behind the move are thinning out — and the chart is often the last to admit it. Divergence trading turns that disagreement into a signal.

What Is OBV Divergence?

On-Balance Volume is a running total: add the period’s volume when price closes up, subtract it when price closes down. The absolute number is meaningless — what matters is the direction and shape of the line, as Investopedia explains. OBV divergence occurs when price and OBV make opposite patterns at extremes:

  • Bearish divergence: price prints a higher high while OBV prints a lower high. The rally is running on less volume than the previous one.
  • Bullish divergence: price prints a lower low while OBV prints a higher low. Selling pressure is drying up even as price slips.

The logic: OBV tracks conviction. Price can drift on thin participation, but sustained moves need volume behind them.

6 days closed at a 40-day high while OBV did notBitcoin daily close and On-Balance Volume, 1 Mar – 24 Nov 2026. Amber dots: close at a 40-dayhigh with OBV below its own 40-day high.$60k$70k$80k-50k050k100kMar 26May 26Jul 26Sept 26Nov 26Price (close)OBV, with its 40-day high in greyData: BTC-USD daily candles from Coinbase. Signals counted, not traded: this is not a backtest.
Hover an amber dot to compare that day's price high with OBV's

Why Does Volume Divergence Matter?

Every price move has two readings — how far it went, and who showed up for it. A breakout on collapsing OBV is a party with no guests: the new high exists, but the accumulation that sustains new highs does not. Divergence does not time reversals precisely. What it does is flag deteriorating quality early, often several swings before the turn. That makes it stronger as a filter and a warning system than as a standalone trigger — the same caveat that applies to MACD divergence.

Making Divergence Mechanical

“Spot the divergence” is easy for eyes and vague for rules. A systematic version compares extremes over a fixed window:

  • Price condition: the current close is the highest close of the last 40 bars.
  • OBV condition: OBV is below its own highest value from that same window.
  • Together: a new price high without a new OBV high — bearish divergence, defined without judgement calls.

Mirror the logic with lowest values for the bullish version. The window length sets sensitivity: shorter windows catch minor divergences, longer ones only the major turns.

The same data gives 15 divergences on a 10-bar window, 4 on 60Days where the close is the highest of the last N bars while OBV sits below its own N-barhigh. Bitcoin daily, 1 Mar – 24 Nov 2026.0510151510 bars1320 bars640 bars460 barsData: BTC-USD daily candles from Coinbase. Signals counted, not traded: this is not a backtest.
The longer the window, the fewer and more meaningful the divergences

The Rule Set for an OBV Divergence Strategy

Bullish Divergence Reversal

  • Setup: price makes a 40-bar low; OBV holds above its 40-bar low.
  • Trigger: price closes back above a short moving average (e.g. 10 EMA) — the turn has begun. Never enter on the divergence alone.
  • Stop: below the divergence low. Target: the prior swing high, or a trailing exit.

OBV as a Breakout Filter

  • Rule: only take breakout entries when OBV sits above its own 20-period moving average.
  • Effect: breakouts backed by volume pass; hollow ones — the classic fake-out fuel — get skipped.

Building It in Arrow Algo

  1. Add an OBV block and connect your candle feed.
  2. Use Max/Min blocks over your chosen window on both price and the OBV output — comparing current values against those extremes defines the divergence mechanically.
  3. Combine the two conditions with an AND gate, then add your trigger: a crossover block on price and a short EMA.
  4. For the filter variant, add a moving average on OBV and gate your existing breakout entries with it.
  5. Backtest on Binance, Coinbase, or HyperLiquid data — and remember exchange volume differs between venues, so test where you trade.
Divergence as blocks: two extremes, one AND gate, one triggerThe bearish rule from this post, wired the way you would build it. The bullish versionmirrors it with lowest values.OBVOn-Balance Volumefrom your candlefeed1Max over 40 barsHighest close andhighest OBV inthe window2ANDClose at itshigh, OBV belowits high3TriggerClose crossesbelow a shortEMA, then thesignal fires4
The bearish rule as blocks; mirror it with lowest values for bullish

What Are the Common Mistakes?

  • Trading divergence without a trigger. Divergences can stretch on for weeks while the trend keeps paying. The price confirmation is the entry; the divergence is only the setup.
  • Reading OBV’s absolute level. The line’s value depends on where the data starts. Only slopes and relative extremes carry information.
  • Ignoring venue differences. Crypto volume is per exchange. OBV on one venue’s thin book can disagree with the market’s true flow.
  • Over-tight windows. Ten-bar “divergences” appear constantly and mean little. Structural turns show up on 30-50 bar comparisons.

What Should You Remember?

  • An OBV divergence strategy trades the gap between price extremes and volume conviction.
  • Bearish: higher price high, lower OBV high. Bullish: lower price low, higher OBV low.
  • Divergence is a setup, never a trigger — demand price confirmation before entering.
  • OBV above its own moving average also makes a clean volume filter for breakout systems.
  • Max/Min blocks in Arrow Algo turn a chart-reading skill into mechanical rules — the complete OBV guide has the full background.

Disclaimer: This content is for educational purposes only and does not constitute financial advice. Trading involves significant risk and you should only trade with capital you can afford to lose. Past performance is not indicative of future results. Always conduct your own research before making any trading decisions.

Ready to build your own automated trading strategies without writing a single line of code? Start for free at Arrow Algo and join thousands of traders who’ve made the switch to systematic trading.

See Arrow Algo first on Google. Add us as a preferred source and our articles show up more in your Top Stories.

Add as a preferred source on Google