Skip to content

Instantly share code, notes, and snippets.

@gojun077
Created October 14, 2011 09:27
Show Gist options
  • Save gojun077/1286672 to your computer and use it in GitHub Desktop.
Save gojun077/1286672 to your computer and use it in GitHub Desktop.
from TimelyPortfolio blog--simple system for Russell Index
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment