Skip to content

Commit

Permalink
curIndex should be set to first.index and not 1
Browse files Browse the repository at this point in the history
In the applyRules function, when evaluating rules we should reference first.index as opposed to the 1st timestamp. This fix is required for any strategy in which rule.subset is used, such as walk.forward.

This is a material change in the behavior, so bumping version and updating 'Date'.

See #90
  • Loading branch information
jaymon0703 committed Apr 15, 2019
1 parent 9ca1b34 commit a2b528c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: quantstrat
Type: Package
Title: Quantitative Strategy Model Framework
Version: 0.15.4
Date: 2019-04-12 $Date$
Version: 0.15.5
Date: 2019-04-15 $Date$
Author: Peter Carl, Brian G. Peterson, Joshua Ulrich, Jasen Mackie, Jan Humme
Depends:
R(>= 3.2),
Expand Down
2 changes: 1 addition & 1 deletion R/rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ applyRules <- function(portfolio,
hold=FALSE
holdtill=first(time(Dates))-1 # TODO FIXME make holdtill default more robust?
mktinstr<-getInstrument(symbol)
curIndex<-1
curIndex<-first.index
if(nrow(mktdata)>1)
freq <- periodicity(mktdata) # run once and pass to ruleOrderProc
else {
Expand Down

0 comments on commit a2b528c

Please sign in to comment.