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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 4 22:29:14 CEST 2010


Author: braverock
Date: 2010-10-04 22:29:13 +0200 (Mon, 04 Oct 2010)
New Revision: 404

Modified:
   pkg/quantstrat/R/orders.R
Log:
- add as.numeric wrappers for OHLC handling for orderProc. 
  fixes bug identified by Thomas Bolton <thomasrbolton <at> yahoo <dot> co <dot> uk>

Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R	2010-10-02 18:12:24 UTC (rev 403)
+++ pkg/quantstrat/R/orders.R	2010-10-04 20:29:13 UTC (rev 404)
@@ -422,7 +422,9 @@
                             stoplimit = {
                                 if (is.OHLC(mktdata)){
                                     # check to see if price moved through the limit
-                                    if(ordersubset[ii,]$Order.Price>Lo(mktdata[timestamp]) & ordersubset[ii,]$Order.Price<Hi(mktdata[timestamp]) ) {
+                                    if( as.numeric(ordersubset[ii,]$Order.Price)>as.numeric(Lo(mktdata[timestamp])) 
+										& as.numeric(ordersubset[ii,]$Order.Price)< as.numeric(Hi(mktdata[timestamp])) ) 
+									{
                                         txnprice = as.numeric(ordersubset[ii,]$Order.Price)
                                         txntime  = as.character(timestamp)
                                     } else {



More information about the Blotter-commits mailing list