Documentation |
Moving average
output = tsmovavg(tsobj,'e',timeperiod,dim) returns the exponential weighted moving average for financial time series object, tsobj. The exponential moving average is a weighted moving average, where timeperiod specifies the time period. Exponential moving averages reduce the lag by applying more weight to recent prices. For example, a 10-period exponential moving average weights the most recent price by 18.18%. (2/(timeperiod + 1)).
output = tsmovavg(vector,'e',timeperiod,dim) returns the exponential weighted moving average for a vector. The exponential moving average is a weighted moving average, where timeperiod specifies the time period. Exponential moving averages reduce the lag by applying more weight to recent prices. For example, a 10-period exponential moving average weights the most recent price by 18.18%. (2/(timeperiod + 1)).
output = tsmovavg(tsobj,'t',numperiod,dim) returns the triangular moving average for financial time series object, tsobj. The triangular moving average double-smooths the data. tsmovavg calculates the first simple moving average with window width of ceil(numperiod + 1)/2. Then it calculates a second simple moving average on the first moving average with the same window size.
output = tsmovavg(vector,'t',numperiod,dim) returns the triangular moving average for a vector. The triangular moving average double-smooths the data. tsmovavg calculates the first simple moving average with window width of ceil(numperiod + 1)/2. Then it calculates a second simple moving average on the first moving average with the same window size.
output = tsmovavg(tsobj,'w',weights,dim) returns the weighted moving average for the financial time series object, tsobj, by supplying weights for each element in the moving window. The length of the weight vector determines the size of the window. If larger weight factors are used for more recent prices and smaller factors for previous prices, the trend is more responsive to recent changes.
output = tsmovavg(vector,'w',weights,dim) returns the weighted moving average for the vector by supplying weights for each element in the moving window. The length of the weight vector determines the size of the window. If larger weight factors are used for more recent prices and smaller factors for previous prices, the trend is more responsive to recent changes.
output = tsmovavg(tsobj,'m',numperiod,dim) returns the modified moving average for the financial time series object, tsobj. The modified moving average is similar to the simple moving average. Consider the argument numperiod to be the lag of the simple moving average. The first modified moving average is calculated like a simple moving average. Subsequent values are calculated by adding the new price and subtracting the last average from the resulting sum.
output = tsmovavg(vector,'m',numperiod,dim) returns the modified moving average for the vector. The modified moving average is similar to the simple moving average. Consider the argument numperiod to be the lag of the simple moving average. The first modified moving average is calculated like a simple moving average. Subsequent values are calculated by adding the new price and subtracting the last average from the resulting sum.