[Blotter-commits] r836 - pkg/quantstrat/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 5 19:43:54 CET 2011


Author: bodanker
Date: 2011-11-05 19:43:54 +0100 (Sat, 05 Nov 2011)
New Revision: 836

Modified:
   pkg/quantstrat/R/orders.R
Log:
- fix stoplimit handling for OHLC data in ruleOrderProc


Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R	2011-11-05 18:24:22 UTC (rev 835)
+++ pkg/quantstrat/R/orders.R	2011-11-05 18:43:54 UTC (rev 836)
@@ -479,14 +479,14 @@
                                 stop("iceberg orders only supported for BBO data")
                             } 
                             # check to see if price moved through the limit
-                            if (orderQty > 0) { # positive quantity 'buy'
+                            if(orderQty < 0) { # negative quantity 'sell'
                                 if( (has.Lo(mktdata) && orderPrice > as.numeric(Lo(mktdataTimestamp))) || 
                                     (!has.Lo(mktdata) && orderPrice >= as.numeric(getPrice(mktdataTimestamp, prefer=prefer))))
                                 {
                                     txnprice = orderPrice
                                     txntime = timestamp
                                 } else next() # price did not move through my order, should go to next order  
-                            } else if(orderQty < 0) { #negative quantity 'sell'
+                            } else if(orderQty > 0) { # positive quantity 'buy'
                                 if ( (has.Hi(mktdata) && orderPrice < as.numeric(Hi(mktdataTimestamp))) ||
                                      (!has.Hi(mktdata) && orderPrice <= as.numeric(getPrice(mktdataTimestamp,prefer=prefer))) )
                                 {



More information about the Blotter-commits mailing list