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.

See #90
  • Loading branch information
jaymon0703 committed Apr 15, 2019
1 parent 9ca1b34 commit 1812b73
Showing 1 changed file with 1 addition and 1 deletion.
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 1812b73

Please sign in to comment.