[Blotter-commits] r1082 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jun 28 11:43:45 CEST 2012
Author: opentrades
Date: 2012-06-28 11:43:45 +0200 (Thu, 28 Jun 2012)
New Revision: 1082
Modified:
pkg/quantstrat/R/ruleOrderProc.R
Log:
* orderQty now set to 0 again in cases where sign and orderside do not match; stop condition removed
Modified: pkg/quantstrat/R/ruleOrderProc.R
===================================================================
--- pkg/quantstrat/R/ruleOrderProc.R 2012-06-28 09:02:35 UTC (rev 1081)
+++ pkg/quantstrat/R/ruleOrderProc.R 2012-06-28 09:43:45 UTC (rev 1082)
@@ -97,7 +97,12 @@
orderside<-ordersubset[ii, "Order.Side"]
if(((orderQty>0 && orderside=='long') || (orderQty<0 && orderside=='short')))
{
- stop('trying to exit/market/all position but orderQty sign does not match orderside')
+ # this condition may occur if (for example) a signal triggers an 'increase LONG pos' and 'close all SHORT pos' simultaneously
+ # hence this is legal condition, and we must 0 the orderQty to reject the order
+
+# warning('trying to exit/market/all position but orderQty sign ', orderQty,' does not match orderside ', orderside)
+
+ orderQty = 0
}
}
orderQty<-as.numeric(orderQty)
More information about the Blotter-commits
mailing list