Hi List!

I would like to calculate the 377-day simple moving average on closing
prices using the SMA function, but an error is always returned:



SMA(Cl(SPY),n=377)Error in runSum(x, n) : Invalid 'n'



Here is some code in order for you to quickly reproduce what I am doing:



getSymbols("SPY", from='1995-01-01', to='2010-01-01',
index.class=c("POSIXt","POSIXct"))

SPY = to.monthly(SPY, indexAt='endof')

mysma<-SMA(Cl(SPY),n=377)



Thank you very much!



Anna

	[[alternative HTML version deleted]]

