data(ttrc)
ema.20 <- EMA(ttrc[,"Close"], 20)
sma.20 <- SMA(ttrc[,"Close"], 20)
dema.20 <- DEMA(ttrc[,"Close"], 20)
evwma.20 <- EVWMA(ttrc[,"Close"], 20)
zlema.20 <- ZLEMA(ttrc[,"Close"], 20)
## Example of short-term instability of EMA
x <- rnorm(100)
tail( EMA(x[90:100],10), 1 )
tail( EMA(x[70:100],10), 1 )
tail( EMA(x[50:100],10), 1 )
tail( EMA(x[30:100],10), 1 )
tail( EMA(x[10:100],10), 1 )
tail( EMA(x[ 1:100],10), 1 )
Run the code above in your browser using DataLab