Learn R Programming

FRAPO (version 0.3-7)

trdes: Exponentially Smoothed Trend

Description

Calculation of the exponentially smoothed trend as a technical trading indicator.

Usage

trdes(y, lambda, init = NULL)

Arguments

y
Objects of classes: numeric, matrix, data.frame, ts, mts, timeSeries, zoo and xts are supported.
lambda
Numeric, the smoothing parameter for $\lambda$ in the equation below. The value for the parameter must be in the interval $0 < \lambda < 1$.
init
The initial value in the recursive calculation of the filter. Specifies the initial values of the time series just prior to the start value, in reverse time order. The default, i.e. NULL, is a set of zeros.

Value

  • An object of the same class as y, containing the computed exponetially smoothed values.

concept

  • Exponential Smoothing
  • Trend
  • ES Trend

Details

The exponetially smoothed trend is calculated according to the formula: $$z_t = \lambda y_t + (1 - \lambda) * z_{t-1}$$

See Also

filter, trdbilson, trdbinary, trdhp, trdsma, trdwma, capser

Examples

Run this code
data(StockIndex)
y <- StockIndex[, "SP500"]
yret <- diff(log(y))
es <- trdes(yret, lambda = 0.95)
head(es)

Run the code above in your browser using DataLab