Part of the Indicator Math series. This time, you’ll see what changes when an indicator counts volume as well as price.

A one-cent move can count the whole day’s volume

Say a stock closes a penny higher on two million shares. On-Balance Volume, or OBV, adds all two million to its running total. If the stock had closed a penny lower instead, OBV would subtract all two million. The indicator didn’t see two million eager buyers or sellers. It saw one closing price and assigned the whole bar’s volume a sign.

That little decision is the indicator. It lets you compare the volume that traded on higher-closing bars with the volume that traded on lower-closing bars. If you were expecting a count of who bought or sold, you were asking the line a question it cannot answer.

The OBV formula and two ways to count differently

Joe Granville described OBV in his 1963 book Granville’s New Key to Stock Market Profits, as documented by StockCharts’ OBV guide. There’s no default lookback in the raw formula. Pick a bar interval, compare each close with the previous one, and carry the running total forward. Volume is the shares traded during the bar for a stock, or contracts traded for a futures contract. We’ll start the total at zero for the example; a different starting value shifts the whole line without changing its moves on shared bars.

New OBV = prior OBV + signed volume
Higher close: signed volume = +current bar volume
Lower close: signed volume = −current bar volume
Equal close: signed volume = 0

Accumulation/Distribution: Where did this bar close?

Marc Chaikin’s Accumulation/Distribution Line, or A/D line, also has no fixed lookback. Instead of comparing closes, it uses the current bar’s high, low, and close. A close at the high gives the bar’s volume full positive weight; a close at the low gives it full negative weight. A midpoint close counts for zero. If the high and low are equal, use a zero multiplier here so you don’t divide by zero.

Close location = (close − low) − (high − close)
Multiplier = close location ÷ (high − low)
New A/D = prior A/D + (multiplier × bar volume)

Money Flow Index: What’s the balance in a recent window?

Gene Quong and Avrum Soudack presented the Money Flow Index (MFI) in a 1989 article on volume-weighted RSI. MFI uses a rolling window. StockCharts’ MFI guide identifies 14 bars as both the creators’ recommendation and its default.

Start with typical price, the average of the high, low, and close. Multiply that by the bar’s volume to get raw flow. When typical price rises from the prior bar, put the raw flow in an up bucket. When it falls, put the raw flow in a down bucket, still as a positive amount. A tie uses up a bar in the window but adds zero to both sums.

Typical price = (high + low + close) ÷ 3
Raw flow = typical price × bar volume
Up flow = sum of up bucket in the last N bars
Down flow = sum of down bucket in the last N bars
MFI = 100 × up flow ÷ (up flow + down flow)

Here N is the window length. For positive down flow, dividing up flow by the total gives the same result as the usual ratio formula below. The share-of-total version also makes the edges easy to see. With only up flow, MFI is 100; with only down flow, it’s zero. If both are zero, the formula is undefined. Check what your platform displays in that case.

Flow ratio = up flow ÷ down flow
MFI = 100 − 100 ÷ (1 + flow ratio)

MFI gets called volume-weighted RSI because both map an up-versus-down ratio onto a 0–100 scale. It’s not RSI with one input added. MFI uses rolling sums of typical price times volume, not Wilder-smoothed changes in the close.

Work through seven bars by hand

Use this fictional stock and seed OBV at zero on bar 1. Its first close gives you a reference; you can’t tell whether that first bar closed up or down without the bar before it. The first five columns are enough to reproduce all three indicators, but start with the OBV column.

BarHighLowCloseSharesOBV
151.0049.0050.00120,0000
252.0050.0051.00100,000100,000
350.0048.0049.50260,000−160,000
451.0049.0049.50180,000−160,000
552.0050.0051.5090,000−70,000
653.0051.0052.00110,00040,000
753.0050.0051.00210,000−170,000

Bar 2 adds 100,000 because 51 is higher than 50. Bar 3 subtracts 260,000 because 49.50 is lower than 51. Bar 4 closes at the same 49.50, so the 180,000 shares traded on that bar make no difference to OBV. By bar 7, the stock closes at 51 again, but OBV is at −170,000 rather than the 100,000 it showed on bar 2. Same price, different mix of volume along the way.

Now look at bar 3 through the A/D formula. The close is 1.50 above the low and 0.50 below the high. The difference of 1.00 divided by the 2.00 range gives a multiplier of 0.50. Half of 260,000 is 130,000, so A/D rises by that amount even as OBV falls. On bar 4, the two lines differ again: OBV stays flat, but A/D falls by 90,000 because the close is in the bottom half of the new bar.

For MFI, shorten the window to three for this example and use bars 2 through 4. Typical price on bar 1 is 50.00, so bar 2’s typical price of 51.00 puts 5,100,000 in the up bucket. On bar 3, add 50.00, 48.00, and 49.50 and divide by three. Typical price falls to about 49.1667. Multiply the unrounded result by 260,000 shares for about 12,783,333 in the down bucket.

On bar 4, divide 149.50 by three and typical price rises to about 49.8333, even though the close didn’t change. Multiply by 180,000 shares for 8,970,000 in the up bucket. Divide 14,070,000 of up flow by about 26,853,333 of total flow and multiply by 100. MFI is 52.40. Keep the unrounded typical prices in the spreadsheet.

What these volume indicators actually measure

The chart below lines up daily SPY prices, OBV, and volume from January 2 to June 30, 2026, with OBV starting at zero. On March 20, a 1.70% price drop set the sign. The 163.6 million shares traded that day set the size of the OBV drop.

SPY daily candles, On-Balance Volume and volume bars; a heavy-volume down day on Mar 20 drops OBV sharply.
SPY daily, Jan 2–Jun 30, 2026, with OBV: on Mar 20, a 1.70% drop on 163.6M shares cut OBV by the full 163.6M in one bar.

OBV counts traded volume by the sign of the close-to-close move. The A/D line counts it by how the bar finished inside its own range. MFI sizes each observation by price times volume, then compares up and down observations in a fixed window. Each can disagree with the other two without any of them being wrong. Before you interpret the difference, ask which input took a different path.

None of these indicators sees which side initiated individual trades, how much traded at which price, or whether a fund is building a position. Every matched trade has a buyer and a seller. The “money flow” in the formulas is a label for an estimate, not a record of actual cash going into or out of a market. If you want a volume-weighted price benchmark instead of a volume tally, that’s a different job for VWAP.

How traders use it

  • Breakout confirmation: For a stock closing above a well-defined 20-bar price range, test requiring OBV to close above its own previous 20-bar high at the same time. Compare that with the price breakout alone using the same risk and exit rules. A filter earns its place by improving a decision, not by looking right on one chart.
  • Divergence as a watchlist flag: If price makes a higher swing high while OBV makes a lower swing high, mark the stock for review rather than shorting it on sight. Define a swing high in advance and test a separate trigger, such as a close below the intervening price low. If your swing definition needs bars on the right, don’t act before those bars have closed.
  • ES session filter: For a regular-session opening range breakout, test requiring OBV at the breakout close to be above its level at the end of the range for a long. Use a fixed bar interval, a single contract month, and a consistent session definition. Otherwise you’re changing which volume the tally counts while trying to judge the same play.
  • MFI in a defined range: If price is testing established support in a sideways market, test waiting for MFI to close back above 20 before considering a long. Treat 20 as a rule to test, not a bargain price. If support has broken, an MFI turn is not a reason to ignore it.

Where it fails

A large earnings or rebalance bar can dominate OBV long after that session ends. If you change from five-minute to daily bars, you also change when you assign the sign. Those are not equivalent tallies with different labels. And on a live bar, one tick across the prior close can turn accumulated volume from positive to negative. Use closed bars if your test assumes you had the final sign.

Check what the data feed calls volume. A cash index doesn’t have a directly traded share or contract count of its own. On an unadjusted continuous futures chart, check where the feed switches from the expiring contract to the next one. A price jump at the splice can assign volume a sign the individual contract wouldn’t have given it. MFI has a different trap: an old heavy bar dropping out of a short window can move the reading even when the new bar tells you little.

Takeaway: OBV signs the whole bar’s volume by its close-to-close direction. A/D weights volume by where the close lands inside the bar, and MFI compares rolling sums of positive and negative flow. Pick the tally that answers your question and let a separate price rule decide what you do with it.

Next up: Combining Indicators Without Redundancy: One Job Per Indicator

One thought on “OBV and Money Flow: What Volume Indicators Actually Count”

Leave a Reply