Sidechair

ta.obv

Browse the reference

On-balance volume: a running total that adds the bar's volume when the close rises and subtracts it when the close falls.

Try it in the editor

ta.obv is a running total rather than a function: each bar it adds the bar's volume when the close rose and subtracts it when the close fell. An unchanged close adds nothing.

The first bar is na and the total starts on bar two. Only the direction and the slope of the line carry meaning, because its absolute level depends on where the loaded history starts.

Type

series float

Remarks

  • Compare its trend with price: rising OBV with flat price shows volume leaning to buyers.

Example

Pine ScriptOBV with a smoothing lineOpen in editor
//@version=6
indicator("On-balance volume")
plot(ta.obv, "OBV", color = color.blue)
plot(ta.sma(ta.obv, 20), "OBV SMA", color = color.orange)

See also

Runs on Sidechair