[R] Getting previous day data and implementing it for quantstrat

boredstoog boredstoog at mailinator.com
Tue Aug 11 14:27:34 CEST 2015


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.



More information about the R-help mailing list