OBV

Volume added on up candles and subtracted on down candles, over recent candles.

On-Balance Volume over the last length candles: Σ of +volume when the close rose, −volume when it fell, 0 when unchanged. Summed over a rolling window instead of since an arbitrary first candle, so the value is the same after every restart. Ready at length + 1 candles. Mirror: signed (a mirrored price swaps up and down candles; volume is unchanged).

Settings

SettingDefaultRangeWhat it does
length201 to 5000Candles summed.

What it gives

OutputWhat it is
obvSigned volume sum.

What it reads

It reads the whole candle (open, high, low, close and volume).

Warm-up

With its default settings, OBV needs 21 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses OBV with its default settings