VALYNOX
VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

On balance volume: how OBV is calculated and what it confirms

On balance volume adds a bar's volume when the close rises and subtracts it when the close falls. It confirms a move only when its swing highs or lows keep pace with price; the level on the axis means nothing. Test it as an explicit filter on a base rule, with costs, and check roll days first.

By · Published · updated · Editorial policy

Contents
  1. How is on balance volume calculated, and does it confirm price moves?
  2. How do you read OBV on a chart?
  3. What is OBV divergence and how do you spot it?
  4. How does OBV differ from plain volume?
  5. Why do contract rolls distort OBV on futures?
  6. How do you test OBV as a trend filter, and what did our NQ run show?
  7. Frequently asked questions
  8. References

How is on balance volume calculated, and does it confirm price moves?

On balance volume (OBV) is a running total of volume: each bar's volume is added when the close is higher than the previous close and subtracted when it is lower. OBV confirms a price move only when its own swing highs or lows keep pace with price; its absolute level means nothing because it depends on the start date.

Think of OBV as a bank balance. Every up-close bar deposits that bar's volume, every down-close bar withdraws it, and a bar that closes unchanged does nothing. The balance you see today depends on the day you opened the account, so two traders with different chart histories read different numbers on the same market. The OBV indicator page gives the full definition; this article is about reading and testing it on futures.

The formula worth remembering:

OBV today = OBV yesterday + volume today (if close is up), − volume today (if close is down), or unchanged (if close is equal)

Here OBV yesterday is the running total after the previous bar, volume today is the number of contracts traded on the current bar, and close is up means the current close is higher than the previous close. Nothing in the formula looks at how far price moved. Only the sign of the change matters.

Hypothetical example

Six daily bars close at 100, 102, 101, 101, 104 and 103, with volumes of 500, 700, 400, 600, 800 and 300 contracts. Start OBV at zero on the first bar. Bar two closes up, so add 700: OBV is +700. Bar three closes down, so subtract 400: +300. Bar four closes unchanged: still +300. Bar five closes up, add 800: +1,100. Bar six closes down, subtract 300: +800. Had you started one week earlier, every value would be shifted by the same amount, but the shape would be identical.

OBV is a running total: six hypothetical bars close at 100, 102, 101, 101, 104 and 103 on volumes of 5, 7, 4, 6, 8 and 3 hundred contracts. Up closes add volume, down closes subtract it, and an unchanged close does nothing, so OBV reads 0, 7, 3, 3, 11 and 8 hundred OBV is a running total Hypothetical, volume in hundreds Close 100 102 101 101 104 103 Volume 5 7 4 6 8 3 OBV 0 +7 +3 +3 +11 +8 Only the close direction counts. So: read its shape, not its level.
OBV is a signed running total, not an average. Each bar adds, subtracts or leaves the total unchanged, depending only on the direction of the close.

Does it confirm price moves? Only in one narrow sense. When price makes a new high and OBV also makes a new high, the rise came with more volume on up bars than on down bars, which is what most traders mean by "confirmed". When price makes a new high and OBV does not, the rise came on thinner buying. That second case is the only pattern in OBV that is worth writing down as a rule, and the rest of this article is about how to do that honestly.

How do you read OBV on a chart?

Read OBV by its slope and by whether its swing highs and lows match the swing highs and lows of price; ignore the numeric value on the axis. The level is an accident of your start date, so "OBV is at 2 million" carries no information. "OBV made a lower high while price made a higher high" does.

Three things to look at, in this order:

  1. The slope over the last few swings. A rising OBV means up-close bars have carried more volume than down-close bars recently. A flat OBV means the two sides are roughly balanced, whatever price did.
  2. Swing highs. Mark the last two swing highs in price and the OBV values at those same bars. If the second OBV high is above the first, the up move is confirmed. If it is below or equal, it is not.
  3. Swing lows. The mirror check for down moves. A new price low with an OBV low that holds above the previous one is the pattern traders call bullish divergence.
Two panels with the same price line making a higher high: on the left OBV also makes a higher high, so the move is confirmed; on the right OBV makes a lower high, so the move is not confirmed Same price, different OBV Compare the two swing highs Confirmed Not confirmed Price OBV Price OBV Same price; only OBV differs. So: compare swing highs, not levels.
Both price panels look the same. Only the OBV panel separates a confirmed move from one that is not confirmed.

A rising price with a flat or falling OBV is the one pattern that deserves a rule. Everything else you can see in OBV, such as "OBV is trending up", is already visible in price itself, because up closes and up trends go together by construction. A chart with OBV below price is best read like a scale that has lost its zero mark: the differences between readings are meaningful, the readings themselves are not.

What is OBV divergence and how do you spot it?

OBV divergence is price making a new swing high (or low) while OBV fails to make one, and it can only be tested once the swing definition, the lookback and the minimum gap are written as exact numbers. Read by eye, divergence is wherever the reader wants it to be. Written as a rule, it is either present on a bar or it is not.

A swing high is a bar whose high is higher than the highs of the N bars on each side of it. That N, the swing width, is the first number you need. The second is the lookback: how many bars back the previous swing high may sit and still count as a pair. The third is the minimum shortfall: how far below its previous swing high the OBV value must be before you call it a lower high, usually written as a percent of the recent OBV range so it does not depend on the start date.

Price makes a higher swing high 20 bars after the first while OBV makes a lower one; the figure marks the three inputs that make this divergence testable: the swing width, the 20-bar lookback and the minimum OBV shortfall in percent Divergence needs three numbers Fix them before you look Price OBV Lookback 20 bars Swing width Shortfall % Three numbers turn a look into a rule. So: write them before the chart.
Divergence becomes testable only when the swing width, the lookback and the minimum OBV shortfall are written as numbers.

Two consequences follow from the definition. First, the signal is late. A swing high with width 5 is only known five bars after the high itself, so a divergence rule fires at least five bars after the second swing. The Hilbert oscillator's cycle reading has the same property, and for the same reason: a turning point can only be named once later bars have shown it was a turn. Second, the choice of width and lookback changes what you find, in the same way that the choice of anchor points decides what a Fibonacci retracement test measures. Lo, Mamaysky and Wang (2000) showed that chart patterns can be defined by algorithm and then counted; that is the standard to hold OBV divergence to.

Chart-tool packages often draw divergence labels for you. Before using those labels in a test, check on which bar each label was placed. Many are placed on the swing bar but could only have been known several bars later, which is the same timing question that comes up when backtesting LuxAlgo signals or any other drawn marker.

How does OBV differ from plain volume?

Plain volume says how much traded on a bar with no direction, while OBV gives every bar a sign from the close direction and accumulates it, so OBV carries direction but throws away how far price moved. A bar that closes one tick higher on heavy volume adds exactly as much to OBV as a bar that rallies 100 points on the same volume. Plain volume cannot tell you which side was active; OBV cannot tell you how strong the move was.

PropertyPlain volumeOBV
What the bar value isContracts traded on that barRunning total of signed volume
Has a directionNoYes, from the close direction
Remembers earlier barsNoYes, every bar since the start
1-tick up close vs 100-point up closeSame reading if volume is equalSame reading if volume is equal
Affected by start dateNoYes, the level shifts; the shape does not
Affected by contract rollsDips and spikes on roll daysPermanent steps in the total
Plain volume compared with OBV: plain volume has no direction and no memory, while OBV takes direction from the close and remembers every bar; both ignore the size of the price move; the start date shifts the OBV level; contract rolls cause dips and spikes in volume but lasting steps in OBV OBV adds direction, not size Plain volume OBV Direction No Yes Memory None Every bar Move size Ignored Ignored Start date No effect Shifts level Contract rolls Dips, spikes Steps stay OBV adds a side, not a size. So: neither replaces momentum.
OBV keeps direction and loses magnitude. Plain volume keeps magnitude and has no direction.

This is why the two are not interchangeable in a rule. A volume filter such as "trade only when volume is above its 20-bar average" asks whether the market is active. An OBV filter asks whether recent activity leaned to the buy side or the sell side. Both ignore the size of each bar's price change, so neither replaces a momentum reading. Where OBV sits among the other common tools is covered in the guide to technical analysis tools and indicators you can test.

Why do contract rolls distort OBV on futures?

Volume migrates from the expiring contract to the next one over several days around rollover, so a continuous series built from one contract at a time shows volume dips and spikes that OBV turns into permanent steps in its running total. Because OBV never forgets a bar, a roll-day distortion does not wash out. It stays in the level forever and shifts every later swing high and low by the same amount.

A continuous series is a price history stitched from successive contracts so that a strategy can be tested across many expiries as if it were one instrument. Rollover is the point where the series stops using the expiring contract and starts using the next one. For NQ, the E-mini Nasdaq-100 future, contracts expire quarterly in March, June, September and December, and the shift of trading from one contract to the next takes place over the days before expiry rather than in one jump. The exchange can change contract months and expiry rules, so check the current contract specifications on the exchange's contract page before you build a roll schedule. The timing details for this market are in when NQ contract rollover happens and how to roll on volume.

Illustration of ten trading days around a roll: the expiring contract's volume falls towards zero while the next contract's volume rises; on the day the continuous series switches contract, OBV drops in a step that stays in every later value A roll leaves a lasting step Ten days around a roll Illustration Expiring Next Roll day Volume OBV Lasting step The roll step never washes out. So: check roll days first.
Illustrative example. Volume moving between contracts around a roll becomes a false step in continuous OBV that never washes out.

Three things go wrong on a roll, and each one leaves a mark:

  1. Volume of the expiring contract falls for several days before the roll. OBV adds and subtracts smaller amounts, so the line flattens for reasons that have nothing to do with buyers or sellers.
  2. The first bar of the new contract may show a large volume figure while the series' price change across the switch is partly a contract gap, not a market move. OBV adds or subtracts that whole figure with a sign that came from the gap.
  3. If the series is back-adjusted in price but not matched in volume, the close direction used to sign the volume may come from one contract while the volume comes from another.

Two practical answers. Use the volume of the contract you would actually trade on each day, rolled by volume rather than by calendar, so the volume series itself has no hole. And before trusting any OBV swing point, look at the bars within a week of each roll in your data and confirm the OBV step there is small compared with the swings you are measuring. On NQ daily data this means checking roughly four stretches a year.

How do you test OBV as a trend filter, and what did our NQ run show?

Turn OBV into one explicit rule, run a base strategy with and without it under the same costs, and judge the filter by the change in average trade after costs. A trend filter is a condition that permits or blocks entries from another rule without generating entries itself. "OBV is above its own 50-bar moving average, so longs are permitted; OBV is below it, so shorts are permitted" is a complete filter. "OBV looks strong" is not.

The order of steps matters because a filter can only be judged against the rule it filters:

  1. Write the base entry and exit rule with no filter, and fix the bar size, the session and the market.
  2. Write the OBV filter as an exact condition: which moving average length, which comparison, whether it applies to entries only or also forces exits.
  3. Run the base rule alone with commission and slippage charged on every trade.
  4. Run the base rule plus the filter with identical settings, changing nothing but the filter.
  5. Compare average trade after costs and trade count. A good filter raises the average trade while keeping enough trades to judge. A filter that leaves 20 trades out of 120 has not improved the rule; it has removed the sample.
Five steps to test an OBV filter: write the base rule, write the OBV filter, run the base rule with costs, run the base rule plus the filter, and compare the average trade; an arrow loops from the comparison back to the filter step, changing only the filter Test OBV against a base rule Five steps, same costs 1 2 3 4 5 Write the base rule Write the OBV filter Run base, with costs Run base + filter Compare average trade Change only the filter Only the filter changes between runs. So: judge by average trade and count.
Base rule first, filter second, same costs on both runs. Only the filter changes between run three and run four.

What does a report to compare against look like? Below is a real run from AlphaPrime (Valynox) on NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with $20 commission and $10 slippage charged per trade. It does not test OBV. It uses a Fractal rule as its only entry and exit, with no stop, no target and no filter, so it is a stand-in base rule of the kind you would build in step one. It is also the one candidate the search kept out of 1,024 it tried, chosen for its return against its drawdown, and picking the kept one after the fact flatters it. Bailey and colleagues (2014) describe why the best of many tries is inflated relative to what the same rule would do on new data.

Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.

NumberResult
Net profit (closed trades)$119,660
Max drawdown$30,220
Trades124
Win rate58.06%
Profit factor1.722
Average trade$965
Time in market12.44%
Look at the depth of the drawdown relative to the climb, and at how the marked out-of-sample stretch compares in slope with the earlier part. A filtered run is judged against the same two features.
Look at the depth of the drawdown relative to the climb, and at how the marked out-of-sample stretch compares in slope with the earlier part. A filtered run is judged against the same two features. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Read the box as a baseline, not as a result for OBV. The average trade after costs is $965 over 124 trades, with a maximum drawdown of $30,220 and 12.44% of the time in the market. If you added an OBV filter to this base rule, the questions for step five are concrete: did the average trade after costs rise above $965, how many of the 124 trades remain, and did the drawdown fall by more than the net profit did? Those are the numbers that tell you whether the filter earned its place, and none of them can be read from an OBV chart alone. Writing the pass level for the filtered run before you see it is the same habit that AlphaPrime's strategy validation enforces by holding every candidate to thresholds you set before the search starts. Park and Irwin (2007), surveying decades of technical-rule studies, found that results depend heavily on how costs and the number of tested variants are handled, which is exactly why both runs must carry the same costs.

The next step is yours to run. Load your own NQ daily data, mark the roll days, and compute OBV with the volume of the contract you would trade. Write the filter as one line with one moving-average length. Then run your base rule twice, once with the filter and once without, and write down the average trade after costs and the trade count from each run before you look at either equity curve.

Frequently asked questions

What is a good OBV value?

There is no good or bad OBV value. OBV is a running total that starts at whatever point your chart history begins, so the number on the axis shifts with the start date. Read the slope and compare OBV swing highs and lows with the swing highs and lows of price. A rising price with a flat or falling OBV is the pattern worth attention.

Is OBV a leading indicator?

OBV is built from the current bar's close direction and volume, so the line itself is not ahead of price. The divergence pattern that traders read from it can only be identified after the second swing point is complete, which means a divergence rule fires several bars after the swing. Whether that late signal still helps a strategy is a question for a backtest with costs, not a property of the indicator.

Does OBV work on futures contracts?

OBV can be computed on any bar series that has volume, including futures. The specific problem on futures is contract rollover: volume moves from the expiring contract to the next one over several days, and a continuous series stitched from one contract at a time turns those dips and spikes into permanent steps in OBV. Use the volume of the contract you would actually trade and inspect the bars around each roll before trusting a swing point.

Can OBV be used on intraday bars?

Yes, the calculation is the same on 5-minute bars as on daily bars. Two things change. Volume is concentrated in certain sessions, so OBV will climb or fall fastest around the open and the close regardless of trend, and the start of each session is a natural place to reset the running total so that overnight volume does not dominate. Write the reset rule down before testing, because it changes every OBV value that follows.

References

  • Lo, A. W., Mamaysky, H., & Wang, J. (2000). Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation. The Journal of Finance, 55(4), 1705–1765.
  • Park, C.-H., & Irwin, S. H. (2007). What Do We Know About the Profitability of Technical Analysis? Journal of Economic Surveys, 21(4), 786–826.
  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
  • CME Group. E-mini Nasdaq-100 Futures Contract Specs. https://www.cmegroup.com/markets/equities/nasdaq/e-mini-nasdaq-100.contractSpecs.html