30 likes | 231 Views
Portfolio Correlation Analysis Tool. Snippet of Code. #Chart for Quartly Correlation toptitle = paste("Time Series Correlation"," ",hname," ",gname) plot(corplot, xaxt="n", pch=22, ylim=c(-1,1), type="o", lty=1, main=toptitle, col="green")
E N D
Snippet of Code #Chart for Quartly Correlation toptitle = paste("Time Series Correlation"," ",hname," ",gname) plot(corplot, xaxt="n", pch=22, ylim=c(-1,1), type="o", lty=1, main=toptitle, col="green") lines(corplot2,type="o", lty=2, pch=25,col="red") axis(1, at=1:4, lab=c("Q1","Q2","Q3","Q4")) legend(1, 1, c("2009","2008"), cex=0.8, pch=c(22,25), col=c("green","red"), lty=1:2) mtext("Correlations by Quarter") #Chart for YTD 2008 plot(hcor,gcor,main=stocktitle, xlab=hname, ylab=gname) mtext("2008") mtext("Created by Andrew Ilardi", side=1, line=3, adj=4.1) mtext("www.andrewilardi.com", side=1, line=4, adj=3.4) #Chart for YTD 2009 plot(hcor2,gcor2,main=stocktitle2, xlab=hname, ylab=gname) mtext("2009") dev.off() printcor = paste(hname,gname," ", stocktitle) #print(printcor) #excel layout CSV sink("C:/Stock/testoutput.csv", append=TRUE) excelprint = paste(hname,",",gname,",", titlecor$estimate, "," , titlecor$p.value, "," , titlecor2$estimate, "," , titlecor2$p.value) print(excelprint) Sys.sleep(2) sink() } } print("I am done. Andrew rocks")