On Balance Volume

Cumulative volume-based momentum indicator that relates price changes to volume flow.

About the On Balance Volume

On Balance Volume (OBV) is a cumulative volume-based momentum indicator that relates price changes to volume flow. Developed by Joe Granville in 1963, it operates on the principle that volume precedes price movement.

What It Measures

On Balance Volume measures the cumulative buying and selling pressure by adding volume on days when prices close higher and subtracting volume on days when prices close lower, helping identify whether volume is confirming or diverging from price trends.

When to Use

  • Trend Confirmation: Verify that OBV moves in the same direction as price to confirm trend strength and sustainability
  • Divergence Detection: Identify potential trend reversals when OBV diverges from price (price makes new highs/lows but OBV doesn't)
  • Breakout Validation: Confirm price breakouts with OBV also breaking through previous resistance or support levels
  • Accumulation/Distribution Analysis: Detect accumulation phases (rising OBV during sideways price action) or distribution phases (falling OBV during sideways price action)
  • Volume-Price Relationship: Understand whether volume is supporting or contradicting price movements

Interpretation

  • Rising OBV: Indicates buying pressure and accumulation; suggests uptrend is backed by volume
  • Falling OBV: Indicates selling pressure and distribution; suggests downtrend is backed by volume
  • OBV Confirms Price: When OBV moves in the same direction as price, the trend is considered strong and likely to continue
  • Bullish Divergence: Price makes lower lows while OBV makes higher lows; suggests weakening downtrend and potential reversal to upside
  • Bearish Divergence: Price makes higher highs while OBV makes lower highs; suggests weakening uptrend and potential reversal to downside
  • Flat OBV During Price Move: Indicates lack of volume support; the price movement may not be sustainable
  • Cumulative Nature: OBV is a running total starting from the initial value (typically 0.0); focus on the direction and pattern rather than absolute values

Example Usage

use centaur_technical_indicators::momentum_indicators::bulk::on_balance_volume;

pub fn main() {
    // fetch the data in your preferred way
    // let closes = vec![...];  // closing prices
    // let volumes = vec![...];  // volume data
    
    let obv = on_balance_volume(&closes, &volumes, 0.0);
    println!("OBV: {:?}", obv);
}
import centaur_technical_indicators as cti

# Calculate On Balance Volume
obv = cti.momentum_indicators.bulk.on_balance_volume(closes, volumes, 0.0)
print("OBV:", obv)
import init, { 
    momentum_bulk_onBalanceVolume
} from 'https://cdn.jsdelivr.net/npm/centaur-technical-indicators@latest/dist/web/centaur-technical-indicators.js';

await init();

// fetch the data in your preferred way
// const closes = [...];  // closing prices
// const volumes = [...];  // volume data

const obv = momentum_bulk_onBalanceVolume(closes, volumes, 0.0);
console.log("OBV:", obv);