Re: [R] SMA and EMA in package TTR

2011-02-02 Thread Joshua Ulrich
Hi Anyi, That's not currently possible. You could use the rollmean function in the development version of the zoo package (on R-forge) to calculate the simple moving average as you described. I would like to add this as an option to TTR functions, but it is not high on my priority list. I would

[R] SMA and EMA in package TTR

2011-01-29 Thread Anyi Zhu
Hi, Just wondering for the SMA and EMA in package TTR, is it possible to me to code it so that, say if I need to calculate SMA (x, n=100), when the sample size is less than 100, it will give me the SMA (x, k) where k is the sample size of the data? Right now it only gives me an invalid n error. T