onbalvol

On-Balance Volume (OBV)

Syntax

obv = onbalvol(closep, tvolume)
obv = onbalvol([closep tvolume])
obvts = onbalvol(tsobj)
obvts = onbalvol(tsobj, ParameterName, ParameterValue, ...)

Arguments

closep

Closing price (vector)

tvolume

Volume traded

tsobj

Financial time series object

Description

obv = onbalvol(closep, tvolume) calculates the On-Balance Volume (OBV) from the stock closing price (closep) and volume traded (tvolume) data.

obv = onbalvol([closep tvolume]) accepts a two-column matrix representing the closing price (closep) and volume traded (tvolume), in that order.

obvts = onbalvol(tsobj) calculates the OBV from the stock data in the financial time series object tsobj. The object must minimally contain series names Close and Volume. The obvts output is a financial time series object with the same dates as tsobj and a series named OnBalVol.

obvts = onbalvol(tsobj, ParameterName, ParameterValue, ...) accepts parameter name/ parameter value pairs as input. These pairs specify the name(s) for the required data series if it is different from the expected default name(s). Valid parameter names are

  • CloseName: closing prices series name

  • VolumeName: volume traded series name

Parameter values are the strings that represent the valid parameter names.

Examples

expand all

Calculate the On-Balance Volume (OBV)

This example shows how to calculate the OBV for Disney stock and plot the results.

load disney.mat
dis_OnBalVol = onbalvol(dis);
plot(dis_OnBalVol)
title('On-Balance Volume for Disney')

References

Achelis, Steven B., Technical Analysis from A to Z, Second printing, McGraw-Hill, 1995, pp. 207 - 209.

See Also

Was this topic helpful?