tsaccel
Acceleration between times
Description
calculates the acceleration of a data series with time distance of
n periods.acceleration
= tsaccel(Data
)
n periods.
adds optional name-value pair arguments. acceleration
= tsaccel(___,Name,Value
)
Examples
Calculate the Acceleration of a Data Series for a Stock
Load the file SimulatedStock.mat
, which provides a timetable (TMW
) for financial data for TMW stock.
load SimulatedStock.mat TMW.Volume = []; % remove VOLUME field acceleration = tsaccel(TMW); plot(acceleration.Time,acceleration.Variables) legend('OPEN','HIGH','LOW','CLOSE') title('Acceleration for TMW')
Input Arguments
Data
— Data with high, low, open, close information
vector | matrix | table | timetable
Data with high, low, open, close information, specified as a vector,
matrix, table, or timetable. For vector input, Data
is a
column vector of high, low, open, and closing prices stored in the
corresponding columns. For matrix input, Data
is an
M
-by-N
column-oriented matrix of
high, low, open, and closing prices stored in the corresponding columns.
Timetables and tables with M
rows must contain variables
named 'High'
, 'Low'
,
'Open'
, and 'Close'
(case
insensitive).
Data Types: double
| table
| timetable
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: accelearation =
tsaccel(TMW,'NumPeriods',10,'Datatype',1)
NumPeriods
— Period difference for acceleration
12
(default) | positive integer
Period difference for acceleration, specified as the comma-separated
pair consisting of 'NumPeriods'
and a scalar positive
integer.
Data Types: double
Datatype
— Indicates if Data
contains the data itself or the momentum of the data
0
(Data
contains
the data itself) (default) | integer with values 0
or
1
Indicates if Data
contains the data itself or the
momentum of the data, specified as the comma-separated pair consisting
of 'Datatype'
and a scalar integer with a value of:
0
–Data
contains the data itself.1
–Data
contains the momentum of the data.
Data Types: double
Output Arguments
acceleration
— Acceleration series
vector | matrix | table | timetable
Acceleration series, returned with the same number of rows
(M
) and columns (N
) and the same
type (vector, matrix, table, or timetable) as the input
Data
.
More About
Acceleration
Acceleration is defined as the difference of two momentum series separated by n periods.
Acceleration is the difference of the current momentum with the momentum n periods ago. By default, acceleration is based on 12-period difference.
References
[1] Kaufman, P. J. The New Commodity Trading Systems and Methods. John Wiley and Sons, New York, 1987.
Version History
Introduced before R2006aR2023a: fints
support removed for Data
input argument
fints
object support for the Data
input
argument is removed.
R2022b: Support for negative price data
The Data
input accepts negative prices.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)