← Back to Home
Trading Signal / Indicator
🔊

On-Balance Volume (OBV)

Track cumulative buying and selling pressure through volume flow.

Start Automating Free →

Want to automate this strategy? Try auto-Trading free — no credit card required.

On-Balance Volume (OBV) chart

Overview

What is On-Balance Volume (OBV)?

On-Balance Volume (OBV) was developed by Joseph Granville and introduced in his 1963 book "Granville's New Key to Stock Market Profits." The concept is elegantly simple: on days when price closes higher, the day's volume is added to a running total; on days when price closes lower, the volume is subtracted. The result is a cumulative volume line that trends alongside — and often ahead of — price.

The core premise is that OBV captures the accumulation (buying) and distribution (selling) of institutional smart money. Large investors accumulate positions quietly over time, which shows up as consistently positive OBV without necessarily moving price significantly — until enough shares are accumulated that price must rise. This "divergence before breakout" pattern makes OBV a leading indicator.

A rising OBV in concert with rising price confirms the uptrend. A divergence — OBV declining while price rises — is a bearish warning that the rally is not being supported by volume and may reverse. The reverse holds for downtrends.

OBV is also used to detect "stealth accumulation": when price is range-bound but OBV is steadily rising, smart money may be building a position ahead of an upside breakout.

How It Works in auto-Trading

Automate It

auto-Trading computes OBV as a running cumulative sum updated on each bar close. The strategy builder provides OBV crossover signals (OBV crossing above/below its own moving average), OBV divergence detection, and OBV trend analysis. Combining OBV breakouts with price breakout signals creates high-confluence entry signals.

Try Free →

Strategy Code

Pick a script below, copy it, and use it on your chart.

Pine Script (TradingView)

This is a TradingView Pine Script example for this indicator. Paste it into the TradingView Pine Editor, add it to your chart, and adjust inputs for your market and timeframe.

//@version=6
strategy("On-Balance Volume (OBV)", overlay=true)
fastLen = input.int(20, "Fast Length")
slowLen = input.int(50, "Slow Length")
fast = ta.ema(close, fastLen)

Get full strategy code access

Enter your email address and full name to unlock this strategy code.

ThinkScript (thinkorswim)

This is a thinkorswim ThinkScript example for this indicator. Open thinkorswim, create a custom study, paste the script, and apply it to your chart.

def obv = OnBalanceVolume();
def obvAvg = ExpAverage(obv, 21);
def trend = ExpAverage(close, 50);
def buySignal = obv crosses above obvAvg and close > trend;
def sellSignal = obv crosses below obvAvg or close < trend;

Get full strategy code access

Enter your email address and full name to unlock this strategy code.

Ready to automate On-Balance Volume (OBV)?

Join thousands of traders who use auto-Trading to execute this strategy automatically, 24/7.

Get Started Free →

All Strategies & Signals

Continue Learning

Trading Strategies

Trading Signals & Indicators