main Content

Movivg.

moving average of a financial time series

Movivg.已更新以接受数据输入作为矩阵,, 要么时间表

语法Movivg.已经改变。不再支持输入参数金宝appand落后,只有一个单一的Windowsize.是S.upported, and there is only one output argument (ma)。If you want to compute the leading and lagging moving averages, you need to runMovivg.两次并调整Windowsize.

描述

ma= movavg(Data类型Windowsize.computes the moving average (MA) of a financial time series.

ma= movavg(___首字母为此添加可选参数首字母

ma= movavg(Data类型W.eights计算使用a的金融时间序列的移动普通(mA)'习惯'类型andW.eights

ma= movavg(___首字母为此添加可选参数首字母

例子

全部收缩

加载文件simulatedstock.mat.,提供时间表(TMW.)for financial data.

加载simulatedstock.mat.类型='线性';Windowsize = 14;ma = movavg(tmw_close,type,windowsize)
马=1000×1100.2500 100.3433 100.8700 100.4916 99.9937 99.3603 98.8769 98.6364 98.4348 97.8491⋮

输入参数

全部收缩

金融系列的数据指定为面向列的矩阵,表或时间表。时间表和表必须包含只有数字类型的变量。

数据类型:||时间表

计算平均值的类型那S.pecified as a character vector or string with an associated value.

数据类型:char|

Number of observations of the input series to include in moving average, specified as a scalar positive integer. The observations include (Windowsize.- 1)以前的数据点和当前数据点。

注意

Windowsize.论点仅适用于移动平均值类型'简单''square-root''线性''广场''指数''三角形', 要么'modified'

数据类型:

自定义权重用于计算作为向量的移动平均值。

注意

重量的长度(N)确定移动平均窗口的大小(Windowsize.)。该W.eights论点仅适用于a'习惯'类型平均水平。

与自定义权重,计算移动平均线W.eights (W.)首先是标准化,使得它们总和:

w(i)= w(i)/ sum(w),因为i = 1,2,...,n

标准化的重量(W.然后用来形成N- 点加权移动平均值(y)输入数据(X):

Y(t)= w(1)* x(t)+ w(2)* x(t-1)+ ... + w(n)* x(t-n)

然后根据名称 - 值对参数中指定的方法调整窗口大小内的初始移动平均值首字母

数据类型:

(可选)表示如何在初始点(在有足够的数据填充窗口之前)计算移动平均值,指定为字符向量或字符串,使用以下值之一:

  • 'shrink'- 初始化移动平均值,使得初始点仅包括观察到的数据

  • 'zero'- 初始化初始点0.

  • '填'- 填充初始点S.

注意

首字母论证适用于所有人类型除了除外的规格'指数'and'modified'选项。

数据类型:char|

输出参数

全部收缩

移动平均系列,以相同数量的行返回(m)和与输入相同的类型(矩阵,表或时间表)Data

References

[1] Achelis,S. B。从A到Z的技术分析第二版。McGraw-Hill,1995,PP。184-192。

Introduced before R2006a