[Blotter-commits] r835 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 5 19:24:23 CET 2011
Author: braverock
Date: 2011-11-05 19:24:22 +0100 (Sat, 05 Nov 2011)
New Revision: 835
Modified:
pkg/quantstrat/R/rules.R
Log:
- apply patch submitted by Daniel Krizian to handle edge case of order entered one period before the end of the series
Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R 2011-11-05 14:06:39 UTC (rev 834)
+++ pkg/quantstrat/R/rules.R 2011-11-05 18:24:22 UTC (rev 835)
@@ -534,17 +534,21 @@
} # end if for trailing orders
} # end else clause for any open orders in this timespan
} # end any open orders closure
- if(hasmktord) {
- curIndex <- curIndex+1
- dindex<-get.dindex()
- } else {
- dindex<-get.dindex()
- if (any(dindex > curIndex)) {
- curIndex<-min(dindex[dindex>curIndex])
- } else curIndex <- FALSE
+
+ if(curIndex){
+ if(hasmktord) {
+ curIndex <- curIndex+1
+ dindex<-get.dindex()
+ } else {
+ dindex<-get.dindex()
+ if (any(dindex > curIndex)) {
+ curIndex<-min(dindex[dindex>curIndex])
+ } else curIndex <- FALSE
+ }
}
- if (is.na(curIndex) || curIndex >= length(index(mktdata))) curIndex=FALSE
+ if (is.na(curIndex) || curIndex > length(index(mktdata))) curIndex=FALSE
+
#debug line
#print(curIndex)
More information about the Blotter-commits
mailing list