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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 10 15:39:52 CEST 2012


Author: braverock
Date: 2012-09-10 15:39:52 +0200 (Mon, 10 Sep 2012)
New Revision: 1174

Modified:
   pkg/blotter/R/chart.ME.R
Log:
- use absolute value of the position size for tick calculations

Modified: pkg/blotter/R/chart.ME.R
===================================================================
--- pkg/blotter/R/chart.ME.R	2012-09-10 12:42:07 UTC (rev 1173)
+++ pkg/blotter/R/chart.ME.R	2012-09-10 13:39:52 UTC (rev 1174)
@@ -163,8 +163,8 @@
         
         # tick P&L
         #Net.Trading.PL/position/tick value=ticks
-        trade$tick.PL <- trade$PosPL/trade$Pos.Qty/tick_value #broek nfor last observation
-        trade$tick.PL[length(trade$tick.PL)] <- last(trade$PosPL)/tick_value/trades$Max.Pos[i]
+        trade$tick.PL <- trade$PosPL/abs(trade$Pos.Qty)/tick_value #broken for last observation
+        trade$tick.PL[length(trade$tick.PL)] <- last(trade$PosPL)/abs(trades$Max.Pos[i])/tick_value
         
         trades$tick.Net.Trading.PL[i] <- last(trade$tick.PL)
         trades$tick.MAE[i] <- min(0,trade$tick.PL)



More information about the Blotter-commits mailing list