ta.obv
Track cumulative volume signed by each bar's direction to confirm a trend.
ta.obv(bars)On-Balance Volume: the running total of each bar's volume, signed by the direction of its close against the previous close. It accumulates from the first bar of the run and reads volume from bars. An unchanged close adds nothing. Like ta.vwap and ta.cum it does not reset at the session open.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Unit | Default | Range | Description |
|---|---|---|---|---|---|---|
bars | Constant | bars | bars | na | - | Which bars to read: a declared series, or na for the chart's own. |
Output
| Name | Type | Unit |
|---|---|---|
value | number | - |
Warm-up and missing values
- Warm-up
- 2 bars.
- Missing values
- na until a second bar has been seen (the first close-to-close direction needs two bars) and one of them carried a volume. A bar with na volume leaves the running total where it was and does not reset it.
Example
ta.obv()plot(ta.obv(), "On balance volume")