tsmom

Momentum between times

Syntax

mom = tsmom(data, nTimes)
momts = tsmom(tsobj, nTimes)

Arguments

data

Data series. Column-oriented vector or matrix.

nTimes

(Optional) Number of times. Default = 12.

tsobj

Financial time series object.

Description

Momentum is the difference between two prices (data points) separated by a number of times.

mom = tsmom(data, nTimes) calculates the momentum of a data series data. If nTimes is specified, tsmom uses that value instead of the default 12.

momts = tsmom(tsobj, nTimes) calculates the momentum of all data series in the financial time series object tsobj. Each data series in tsobj is treated individually. momts is a financial time series object with similar dates and data series names as tsobj. If nTimes is specified, tsmom uses that value instead of the default 12.

Note, to compute a quantity over n periods, you must specify n+1 for nTimes. If you specify nTimes = 0, the function returns your original time series.

Examples

expand all

Calculate the Momentum of a Data Series

This example shows how to calculate the momentum of a data series for Disney stock and plot the results.

load disney.mat
dis = rmfield(dis,'VOLUME'); % remove VOLUME field
dis_Mom = tsmom(dis);
plot(dis_Mom)
title('Momentum for Disney')

References

Kaufman, P. J., The New Commodity Trading Systems and Methods, John Wiley and Sons, New York, 1987.

See Also

Was this topic helpful?