I am a newbie and trying to create my own bactesting code after going through demo(). I am using a *candle engulfing pattern* strategy and this is the formula
buy=(close(1) < close) and (high(1) < high) and (low(1) < low) sell=(close(1) > close) and (high(1) > high) and (low(1) > low) **(1) represents previous day data* How should i get previous day data for close,high and open for the previous day? How should i add indicators,rules and signals to this strategy. This is my idea first create a signal using sig Formula and then add the rules like this BUYING #adding signal strat1<-add.signal(strat1, name="sigFormula", arguments = list(columns=c("Close","High","Low"), formula = "(close(1) < close) and (high(1) < high) and (low(1) < low)", label="trigger", cross=TRUE), label="Bullish engulfing") #adding rule strat1 <- add.rule(strat1, name="ruleSignal", arguments=list(sigcol="trigger", sigval=TRUE, orderqty=100, ordertype="market", orderside="long", pricemethod="market"), type="enter") is this correct! The biggest problem is how i get previous day data for close, high and low -- View this message in context: http://r.789695.n4.nabble.com/Getting-previous-day-data-and-implementing-it-for-quantstrat-tp4710978.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.