OBV
OBV
Summary
On Balance Volume: a running cumulative total of volume, added on up-price bars and subtracted on down-price bars. Relates volume flow to price direction.
Formula
OBV[i] = OBV[i-1] + (inReal[i] > inReal[i-1] ? V[i] : inReal[i] < inReal[i-1] ? -V[i] : 0); seed OBV[startIdx] = V[startIdx]
Inputs
inReal— Price series, typically closeinVolume— Volume of each bar
Outputs
outReal— Cumulative on-balance volume
Properties
Numerical Stability: Path-Dependent
| Display Flags |
|---|
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
Implementation
TA-Lib Definition: obv.c · obv.yaml
| Native | File |
|---|---|
| C | ta_OBV.c |
| Rust | obv.rs |
| Java | Core_OBV.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
On Balance Volume
References
- Joseph Ensign Granville, B. Granville, Granville's New Strategy of Daily Stock Market Timing for Maximum Profit, Simon & Schuster (ISBN 0133634329)