Message-ID: <24793238.post@talk.nabble.com>
Date: 2009-08-03T15:55:39Z
From: ehxpieterse
Subject: n-period return
In-Reply-To: <e8e755250908030537l70d6b3f5q95bae4dd6cb1a185@mail.gmail.com>
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.