Displaying 3 results from an estimated 3 matches for "pricedata".
Did you mean:
price&data
2011 Jul 21
1
for/if loop in R
hi,
Can someone please help me figure out where I am making a mistake in my for/if loop:
I have a data frame (112 rows) called pricedata with 3 columns: date, prices, return.
Now, I want to add a 4th column, trend, which can have 2 values 0 or 1. if return>1%, trend=1 else trend=0.
so, this is what I did:
>trend<-numeric(nrow(pricedata))
>cbind(pricedata,trend)
>for(i in 2:nrow(pricedata)){
+if (return[i]>0.01) t...
2012 Mar 10
1
Generating abnormal returns in R
...,
"AKZA.AS" , "HEN.MU")
for( series in tickers ){
print(series)
close <-
get.hist.quote(instrument=series,retclass="zoo",quote="AdjClose",compression="d",
start="2000-1-1", end="2011-12-31",quiet=TRUE)
if(series==tickers[1]){ pricedata = close }else{ pricedata = merge(
pricedata , close ) }
}
colnames(pricedata) = tickers
# Avoid a missing because of trade halt for that stock
pricedata = na.approx(pricedata)
weeklyR = diff(log(pricedata))
time(weeklyR) = as.Date(time(weeklyR))
print(weeklyR)
save(weeklyR , file = "weeklyR.Rd...
2008 Sep 25
3
OHLC Plot with EMA in it
Hi there
I have some timeseries data which I plot in a OHLC Plot. In the same
plot I'd like to have the EMA of this timeseries. I tried to add the
EMA point to OHLC with lines(), but this doesn't work. Has anyone an
idea how to handle it?
Regards, Michael Zak