I want to add multiple rules based on different signals like SMA50 > SMA10
and MACD > 0
. However, I am getting an error using sigComparision
. Can anyone suggest a better way to do it?
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
I tried your code but seems to get this error:
Error in applyRules(portfolio = portfolio, symbol = symbol, strategy = strategy, : mktdata does not contain 'sigcol': entersig
This is what I did:
There are two obvious approaches you could use: You can build a composite signal function in add rules, or you could use
sigFormula
. The latter is known to be slow. For example see this thread:https://stat.ethz.ch/pipermail/r-sig-finance/2012q1/009310.html
I highlight a key section here:
In the following example (based off the
macd.R
demo in the quantstrat package) you can experiment with both approaches: