Thursday, October 13, 2011

System in 10 Minutes After Twitter

On Twitter last night, I spotted @milktrader from www.algorithmzoo.com doing some range research on equity indexes.  I offered a tweet on the crazy Russell 2000 17% move over 7 days.  Within 10 minutes, I discovered a signal that worked very well.  It probably is worthless, but I thought I would share in case someone cares to play with it.  THIS IS NOT INVESTMENT ADVICE AND WILL PROBABLY LOSE INCREDIBLE AMOUNTS OF MONEY.  If nothing else, it illustrates the power of R.

From TimelyPortfolio
From TimelyPortfolio

R code:

require(quantmod)
require(PerformanceAnalytics)
getSymbols("^RUT",from="1896-01-01",to=Sys.Date())
signal<-ifelse(runMax(RUT[,2],7)/runMin(RUT[,3],7)-1-
    ROC(RUT[,4],n=20,type="discrete")<0.02,1,0)
perf<-merge(lag(signal,k=1)*ROC(RUT[,4],type="discrete",n=1),
    ROC(RUT[,4],type="discrete",n=1))
colnames(perf)<-c("System","Russell 2000")
charts.PerformanceSummary(perf,ylog=TRUE,
    main="Quick Untested Russell 2000 System")

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Could you write in normal language the logic of the system? I'm not a good R programmer,thank you

    ReplyDelete