| Financial Time Series | ![]() |
Syntax
mom = tsmom(data, nperiods) momts = tsmom(tsobj, nperiods)
Arguments
|
Data series |
|
(Optional) Number of periods. Default = 12. |
|
Name of an existing financial time series object |
Description
Momentum is the difference between two prices (data points) separated by a number of periods.
mom = tsmom(data, nperiods)
calculates the momentum of a data series data. If nperiods is specified, tsmom uses that value instead of the default 12.
momts = tsmom(tsobj, nperiods)
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 nperiods is specified, tsmom uses that value instead of the default 12.
Example
Compute the momentum 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')
See Also
| tsaccel | tsmovavg | ![]() |