[Blotter-commits] r1257 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Nov 21 03:28:52 CET 2012
Author: opentrades
Date: 2012-11-21 03:28:48 +0100 (Wed, 21 Nov 2012)
New Revision: 1257
Modified:
pkg/quantstrat/R/ruleOrderProc.R
Log:
changed limit order fill condition for OHLC to >Lo and <Hi instead of >=Lo and <=Hi
Modified: pkg/quantstrat/R/ruleOrderProc.R
===================================================================
--- pkg/quantstrat/R/ruleOrderProc.R 2012-11-21 01:49:36 UTC (rev 1256)
+++ pkg/quantstrat/R/ruleOrderProc.R 2012-11-21 02:28:48 UTC (rev 1257)
@@ -145,24 +145,16 @@
# check to see if price moved through the limit
if((orderQty > 0 && orderType != 'stoplimit') || (orderQty < 0 && (orderType=='stoplimit'))) {
# buy limit, or sell stoplimit
- if( (has.Lo(mktdata) && orderPrice >= as.numeric(Lo(mktdataTimestamp))) ||
- (!has.Lo(mktdata) && orderPrice >= as.numeric(getPrice(mktdataTimestamp, prefer=prefer))))
+ if( (has.Lo(mktdata) && orderPrice > as.numeric(Lo(mktdataTimestamp))) ||
+ (!has.Lo(mktdata) && orderPrice > as.numeric(getPrice(mktdataTimestamp, prefer=prefer))))
{
txnprice = orderPrice
txntime = timestamp
-# if(ordersubset[ii,'Rule']=='EnterLONG')
-# {
-# print('Hebbes!')
-# print(ordersubset[ii,])
-# print(txnprice)
-# print(txntime)
-# print('Hebbes!!')
-# }
} else next() # price did not move through my order, should go to next order
} else if((orderQty < 0 && orderType != 'stoplimit') || (orderQty > 0 && (orderType=='stoplimit'))) {
# sell limit or buy stoplimit
- if ( (has.Hi(mktdata) && orderPrice <= as.numeric(Hi(mktdataTimestamp))) ||
- (!has.Hi(mktdata) && orderPrice <= as.numeric(getPrice(mktdataTimestamp,prefer=prefer))) )
+ if ( (has.Hi(mktdata) && orderPrice < as.numeric(Hi(mktdataTimestamp))) ||
+ (!has.Hi(mktdata) && orderPrice < as.numeric(getPrice(mktdataTimestamp,prefer=prefer))) )
{
txnprice = orderPrice
txntime = timestamp
More information about the Blotter-commits
mailing list