obv
On-Balance Volume (Cumulative volume indicator)
obv(source)
Parameters
| Name | Type | Description |
|---|---|---|
source |
source, optional | Data series to determine direction - price field (close, open, high, low) or indicator output |
Formula
```
If field > field[1]: OBV = OBV[1] + Volume
If field < field[1]: OBV = OBV[1] - Volume
If field = field[1]: OBV = OBV[1]
Where:
- OBV starts at 0 for the first period
- Volume is added on up days, subtracted on down days
```
Examples
obv(); # OBV based on close price (default)
obv(close); # Explicit close-based OBV
x = obv(); x > x[50]; # OBV trending up (confirming uptrend)
Returns
Cumulative On-Balance Volume value (unbounded, can be positive or negative) ## References - TradingView: `ta.obv` - Developed by Joe Granville ## Notes - Rising OBV confirms uptrend (accumulation) - Falling OBV confirms downtrend (distribution) - Divergence between price and OBV signals potential reversal - Requires full price history for accurate cumulative calculation