n-period return
Thanks Jeff,
I'm not too clear on how to use the GetSeries data type, after using diff().
getSymbols("^GSPC", src="yahoo")
CloseData <- Cl(GSPC)
Delta <- diff(CloseData, lag=1)
for (i in 3:length(Delta)) {
if (Delta[i]>Delta[i-1]) sum <- sum + Delta
}
It seems if the variables have no length? Is this something specific to the
way getSymbols create objects?
View this message in context: http://www.nabble.com/n-period-return-tp24788735p24793238.html Sent from the Rmetrics mailing list archive at Nabble.com.