[Blotter-commits] r61 - pkg/demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 5 06:47:41 CET 2009


Author: peter_carl
Date: 2009-03-05 06:47:41 +0100 (Thu, 05 Mar 2009)
New Revision: 61

Modified:
   pkg/demo/turtles.R
Log:
- fixed typos
- reduced graphed time series


Modified: pkg/demo/turtles.R
===================================================================
--- pkg/demo/turtles.R	2009-03-05 05:39:23 UTC (rev 60)
+++ pkg/demo/turtles.R	2009-03-05 05:47:41 UTC (rev 61)
@@ -165,15 +165,15 @@
 cat('Return: ',(getEndEq(Account=account, Date=CurrentDate)-initEq)/initEq,'\n')
 
 if (require(quantmod)) {
-  Buys = portfolio[["XLF"]]$txn$Txn.Price*(Portfolio[[Symbol]]$txn$Txn.Qty>0)
-  Sells = portfolio[["XLF"]]$txn$Txn.Price*(Portfolio[[Symbol]]$txn$Txn.Qty<0)
+  Buys = portfolio[["XLF"]]$txn$Txn.Price*(portfolio[["XLF"]]$txn$Txn.Qty>0)
+  Sells = portfolio[["XLF"]]$txn$Txn.Price*(portfolio[["XLF"]]$txn$Txn.Qty<0)
   Position = portfolio[["XLF"]]$posPL$Pos.Qty
   CumPL = cumsum(portfolio[["XLF"]]$posPL$Trading.PL)
-  chartSeries(XLF['2006::2009',], TA=NULL)
-  plot(addTA(Buys['2006::2009',],pch=2,type='p',col='green', on=1));
-  plot(addTA(Sells['2006::2009',],pch=6,type='p',col='red', on=1));
-  plot(addTA(Position['2006::2009',],type='h',col='blue', lwd=2));
-  plot(addTA(CumPL['2006::2009',], col='darkgreen', lwd=2))
+  chartSeries(XLF['2008::2009',], TA=NULL, type='bar')
+  plot(addTA(Buys['2008::2009',],pch=2,type='p',col='green', on=1));
+  plot(addTA(Sells['2008::2009',],pch=6,type='p',col='red', on=1));
+  plot(addTA(Position['2008::2009',],type='h',col='blue', lwd=2));
+  plot(addTA(CumPL['2008::2009',], col='darkgreen', lwd=2))
 }
 
 # require(PerformanceAnalytics)



More information about the Blotter-commits mailing list