[tech-spec] report -> R plot script

  • From: "Henry Carstens" <carstens@xxxxxxxxxxxxxxxxxxxxx>
  • To: <tech-spec@xxxxxxxxxxxxx>
  • Date: Thu, 20 Jan 2005 10:03:04 -0800

This script loads a custom report from TradeStation and plots the result.

Since the report is automatically dumped by TradeStation w/ the same name
and path, all it takes is a single keypress to run this R script to load and
plot the contents.

Note the forward '/' in the pathname,

--h

-----
# R Chi2
# 011805 hac    v 1.0   Imports a TS Chi^2 csv report and plots it

# loadreport
# loads the chi2 report and returns a dataframe
loadreport<-function() {

       return(read.csv("c:/Chi2 Report.txt"))
}

# plotreport
# plots the chi2 report from the chi2 df
plotreport<-function(chi2df) {

       par(mfrow=c(2,1))

       plot(chi2df$chi2, type='b', xlab='Trade No.', ylab='Chi^2',
main='Chi^2')
       abline(h=10, col='blue')

       plot(chi2df$Act.to.Exp.Wins, type='b', xlab='Trade No.',
ylab='Ratio',
main='Act Wins/Exp Wins')
       abline(h=1, col='blue')
}

# loadandplot
# loads and plots the chi2 report
loadandplot<-function(){

       df<-loadreport()

       plotreport(df)
}


Other related posts:

  • » [tech-spec] report -> R plot script