VolumePine Script v6Built-in Variable

ta.obvOn Balance Volume

On Balance Volume. Measures buying and selling pressure as a cumulative indicator that adds volume on up days and subtracts volume on down days.

Syntax

Syntax
ta.obv

Returns

series float

Code Examples

Pine Script v6 Example
//@version=6
indicator("On Balance Volume")
plot(ta.obv, color=color.yellow)

// the same on pine
f_obv() =>
    ta.cum(math.sign(ta.change(close)) * volume)

plot(f_obv())

Trading Applications

Confirm price trends with volume pressure

Detect divergences for early reversal signals

Identify breakout confirmation with OBV trend

Use OBV slope for momentum analysis

Related Functions

Frequently Asked Questions

ta.obv is On Balance Volume: running sum of volume signed by whether close rose or fell vs the previous close, giving a cumulative view of volume-weighted direction.

Rising OBV with rising price supports the trend. If price makes new highs but OBV does not (bearish divergence), some traders expect weakening buying pressure.

Divergence is when price and OBV disagree—for example price up but OBV flat or down. It can warn that the move lacks volume confirmation, but it is not a timing signal by itself.

Generate ta.obv Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.obv and other built-in functions instantly.