On Balance Volume
By LuxAlgoApr 13, 2020
The On Balance Volume indicator keeps a cumulative running total of volume: each bar's volume is added when the close is higher than the prior close, subtracted when it is lower, and skipped when unchanged. The result is a single line traders read against price to judge whether volume is flowing with advances or with declines — Joe Granville's indicator in its standard unmodified form, cumulative from the first available bar, with an optional smoothing moving average overlay. Since the running total depends on where the loaded history starts, the printed level carries no meaning: direction, swing structure, and agreement with price do all the work.
How to Trade the On Balance Volume?
- OBV rising with price: the advance is carrying participation — volume flow confirms the move.
- OBV refusing to confirm a price extreme: the classic divergence read; a new price high without a new OBV high suggests the push ran on thinner volume.
- OBV breaking its own prior swing while price still ranges: volume flow resolving ahead of price, worth watching for the move it may precede.
- OBV crossing its Smoothing MA (when enabled): an objective trigger for the line's own trend turning, useful precisely because raw OBV has no fixed scale.
On Balance Volume Settings
- Smoothing MA (default disabled): displays a moving average of OBV to act as a smoothing/signal line.
- MA Type (default SMA): moving average type used for the smoothing line; options are SMA, EMA, WMA, and RMA (SMMA).
- MA Length (default 20): bars in the smoothing MA — longer confines crosses to sustained flow shifts.
Frequently Asked Questions
How does OBV differ from the Money Flow Index?
OBV is cumulative and unbounded: it compounds signed volume indefinitely and is read through slope, swings, and divergence. MFI is a bounded 0-100 oscillator that weights flow by typical price and volume over a fixed window, offering overbought and oversold zones OBV cannot provide.
Why does my OBV value differ between charts?
Because the total accumulates from the first available bar, the printed value depends on how much history the chart has loaded — different starting point, different number. Nothing is wrong: the level was never the signal, and slope, swings, and divergences are unaffected by where the count begins.
What alerts does this build include?
The script declares Bullish MA Cross and Bearish MA Cross conditions, firing when OBV crosses above or below its smoothing moving average. They evaluate against the configured MA Type and MA Length even if the Smoothing MA display toggle is off, so the crosses can drive alerts without cluttering the pane.
Free indicator
Get free access to this indicator on the platforms below.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
