[Blotter-commits] r1347 - pkg/blotter/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 6 23:07:51 CET 2013


Author: peter_carl
Date: 2013-01-06 23:07:51 +0100 (Sun, 06 Jan 2013)
New Revision: 1347

Modified:
   pkg/blotter/R/chart.Posn.R
Log:
- fixed a corner case where na.locf doesn't catch an initial NA in series


Modified: pkg/blotter/R/chart.Posn.R
===================================================================
--- pkg/blotter/R/chart.Posn.R	2013-01-06 21:32:24 UTC (rev 1346)
+++ pkg/blotter/R/chart.Posn.R	2013-01-06 22:07:51 UTC (rev 1347)
@@ -53,7 +53,7 @@
     
     CumPL = cumsum(Portfolio$symbols[[Symbol]]$posPL$Net.Trading.PL)
     if(length(CumPL)>1)
-        CumPL = na.locf(merge(CumPL,index(Prices)))
+        CumPL = na.omit(na.locf(merge(CumPL,index(Prices))))
     else 
         CumPL = NULL
     
@@ -79,8 +79,8 @@
     if(!is.null(nrow(Buys)) && nrow(Buys) >=1 ) (add_TA(Buys,pch=2,type='p',col='green', on=1));
     if(!is.null(nrow(Sells)) && nrow(Sells) >= 1) (add_TA(Sells,pch=6,type='p',col='red', on=1));
     if(nrow(Position)>=1) {
-        (add_TA(Positionfill,type='l',col='blue', lwd=2))   
-        (add_TA(Position,type='p',col='blue', lwd=2, on=2))   
+        (add_TA(Positionfill,type='h',col='blue', lwd=2))   
+        (add_TA(Position,type='p',col='orange', lwd=2, on=2))   
     }
     if(!is.null(CumPL))  (add_TA(CumPL, col='darkgreen', lwd=2))
     if(!is.null(Drawdown)) (add_TA(Drawdown, col='darkred', lwd=2, yaxis=c(0,-max(CumMax))))



More information about the Blotter-commits mailing list