Acceleration between times
acc = tsaccel(data, nTimes, datatype) accts = tsaccel(tsobj, nTimes, datatype)
(Optional) Number of times. Default = 12.
(Optional) Indicates whether data contains the data itself or the momentum of the data:
0 = Data contains the data itself (default).
1 = Data contains the momentum of the data.
Name of an existing financial time series object.
acc = tsaccel(data, nTimes, datatype) calculates the acceleration of a data series, essentially the difference of the current momentum with the momentum some number of periods ago. If nTimes is specified, tsaccel calculates the acceleration of a data series data with time distance of nTimes times.
accts = tsaccel(tsobj, nTimes, datatype) calculates the acceleration of the data series in the financial time series object tsobj, essentially the difference of the current momentum with the momentum some number of periods ago. Each data series in tsobj is treated individually. accts is a financial time series object with similar dates and data series names as tsobj.
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.
This example shows how to calculate the acceleration of a data series for Disney stock and plot the results.
load disney.mat dis = rmfield(dis,'VOLUME'); % remove VOLUME field dis_Accel = tsaccel(dis); plot(dis_Accel) title('Acceleration for Disney')
Kaufman, P. J., The New Commodity Trading Systems and Methods, New York: John Wiley & Sons, 1987.