[R] Getting previous day data and implementing it for quantstrat
Joshua Ulrich
josh.m.ulrich at gmail.com
Wed Aug 12 12:39:05 CEST 2015
Please don't cross-post: http://stackoverflow.com/q/31955979/271616
At minimum, tell people that you're cross-posting, so they don't spend
time answering a question that was answered on another forum they do
not follow.
On Tue, Aug 11, 2015 at 7:27 AM, boredstoog via R-help
<r-help at r-project.org> wrote:
> 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 at 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.
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
More information about the R-help
mailing list