Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I have noticed that the Russell 2000 (RUT) acts very differently from most of the other indexes that I have studied.  If we apply the system shown in Shorting Mebane Faber to RUT and then extend it with a simple slope, we notice something very different about RUT behavior.  No clear dominant strategy really emerges.

require(quantmod)
require(PerformanceAnalytics)   getSymbols("^RUT",from="1919-01-01",to=Sys.Date())   RUT <- to.monthly(RUT)[,4]
index(RUT) <- as.Date(index(RUT))   #get 10 month rolling average
avg10 <- runMean(RUT,n=10)   #know I can do this better in R but here is my ugly code
#to calculate 6 month slope of 10 month average
width=6
for (i in 1:(NROW(avg10)-width)) {
#get sp500/crb slope
model <- lm(RUT[i:(i+width),1]~index(RUT[i:(i+width)]))
ifelse(i==1,avg10slope <- model$coefficients, avg10slope <- rbind(avg10slope,model$coefficients))
}
#get xts so we can use
avg10slope <- xts(cbind(avg10slope),order.by=index(avg10)[(width+1):NROW(avg10)])   priceSignals <- na.omit(merge(RUT,avg10,avg10slope))   signalUpUp <- ifelse(priceSignals[,1] > priceSignals[,2] & priceSignals[,3] > 0, 1, 0)
signalUpDown <- ifelse(priceSignals[,1] > priceSignals[,2] & priceSignals[,3] < 0, 1, 0)
signalDownUp <- ifelse(priceSignals[,1] < priceSignals[,2] & priceSignals[,3] > 0, 1, 0)
signalDownDown <- ifelse(priceSignals[,1] < priceSignals[,2] & priceSignals[,3] < 0, 1, 0)   retUpUp <- lag(signalUpUp,k=1)* ROC(RUT,type="discrete",n=1)
retUpDown <- lag(signalUpDown,k=1)* ROC(RUT,type="discrete",n=1)
retDownUp <- lag(signalDownUp, k=1) * ROC(RUT,type="discrete",n=1)
retDownDown <- lag(signalDownDown, k=1) * ROC(RUT,type="discrete",n=1)   ret <- merge(retUpUp,retUpDown,retDownUp,retDownDown,ROC(RUT,type="discrete",n=1))
colnames(ret) <- c("UpUp","UpDown","DownUp","DownDown","RUT")   jpeg(filename="performance summary.jpg",quality=100,
width=6.25, height = 6.25,  units="in",res=96)
charts.PerformanceSummary(ret,ylog=TRUE,
main="RUT 10 Month Moving Average Strategy Comparisons
May 1987-Jun 2011")
dev.off()   jpeg(filename="rolling returns.jpg",quality=100,
width=6.25, height = 6.25,  units="in",res=96)
chart.RollingPerformance(ret,width=36,
dev.off()