System in 10 Minutes After Twitter

October 13, 2011
By

(This article was first published on Timely Portfolio, and kindly contributed to R-bloggers)

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")

To leave a comment for the author, please follow the link and comment on his blog: Timely Portfolio.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags:

Comments are closed.