Skip to content

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 compared bar-over-bar (typically close)
  • inPriceV โ€” Volume added/subtracted each bar

Outputs

  • outReal โ€” Cumulative on-balance volume

Implementation

TA-Lib Definition: obv.c ยท obv.yaml

Native File
C ta_OBV.c
Rust obv.rs
Java Core.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)