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.
Getting previous day data and implementing it for quantstrat
3 messages · boredstoog, Joshua Ulrich
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
Sorry Joshua, I just want diverse solutions for this answer. Sorry for causing any trouble or inconvenience for you. I am withdrawing my question from this forum. -- View this message in context: http://r.789695.n4.nabble.com/Getting-previous-day-data-and-implementing-it-for-quantstrat-tp4710978p4711014.html Sent from the R help mailing list archive at Nabble.com.