quantstrat

quantstrat: how to execute on the same bar? [closed]

≯℡__Kan透↙ 提交于 2019-12-11 02:57:43
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I know that you're not supposed to be doing this but since I almost exclusively trade based on daily and weekly data, I think I'd be getting a more realistic idea of trading ideas if I were able to execute on the same bar instead of buying on next day's open. Thanks! 回答1: You can add

R - Quantstart: Testing Strategy on Multiple Equities

人盡茶涼 提交于 2019-12-10 18:14:17
问题 I'm building a basic trading strategy with a few indicators. My problem is that I want it to run on multiple equities without having to specify each individual equity i want to test. Currently i am able to use a vector to get multiple symbols at once such as below # Get Shares from Yahoo Finance Stocks<- ASX_200_Companies_Copy$Code getSymbols(Stocks, from = from, to = to, src = "yahoo", adjust = TRUE) I can easily generate the vector with a list of stock codes in an excel document. So this

Limit number of Position in Quantstrat

蓝咒 提交于 2019-12-08 00:51:39
问题 I have been scratching my head for the last few days trying to understand how to limit the number of position in a strategy. Its a channel breakout strategy (go long/shirt the 20d breakout channel with a 10d high/low stop loss. I don't want the system to pyramid. Only 1 position is accepted i.e - if on day 1 I have a signal, and the market keeps trending, it will print new signals but they have to be dismissed as we are already in a position. I tried everything i've found but i have been

pennyPerShare quantstrat not working

夙愿已清 提交于 2019-12-07 20:13:03
问题 When I use: stratRank <- add.rule(stratRank, name="ruleSignal", arguments=list(sigcol="EntryCond", sigval=TRUE, orderqty=max.size, ordertype="market", orderside="long", pricemethod="market", replace=FALSE,osFUN=osMaxPos,TxnFees=pennyPerShare), type="enter") stratRank <- add.rule(stratRank, name="ruleSignal", arguments=list(sigcol="ExitCond", sigval=TRUE, orderqty="all", ordertype="market", orderside="long", pricemethod="market", replace=FALSE,TxnFees=pennyPerShare), type="exit") I get an

Installing blotter and quantstrat on GitHub

走远了吗. 提交于 2019-12-04 20:27:01
I am experiencing a hard time in installing the blotter and quantstrat packages from Github. Most helps I can find online are quite outdated issued back then when they are hosted on sourceforge. I try to use the install_github() function and it returns error below. (In fact there is similar error when I try R-Forge) Can anyone provide a clue on what is happening here? install_github("braverock/blotter") Downloading GitHub repo braverock/blotter@master from URL https://api.github.com/repos/braverock/blotter/zipball/master Installing blotter "C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no

R - Loading External Indicators into Quantstrat

你。 提交于 2019-12-04 11:48:30
问题 I noticed that Quantstrat typically takes indicators that are based on price. However, I would like to load several indicators that have been externally calculated along with the price data. For instance, I have 2 extra columns in a csv file that contain my indicators (numbered 1-9). I want to generate a signal based on the numbers in these columns. Thus far, I have been unable to get Quantstrat to read the columns in the csv file. I've attached my code below: library(quantmod) library

Cant install blotter package used for quantstrat

孤街醉人 提交于 2019-12-04 05:30:59
问题 I'm trying to use the quantstrat package in R. I have uploaded/installed the package using install.packages("quantstrat", repos="http://R-Forge.R-project.org") However the once I use require(quanstrat) I get the message : Loading required package: quantstrat Failed with error: ‘package ‘blotter’ required by ‘quantstrat’ could not be found’ I then use install.packages("blotter", repos="http://R-Forge.R-project.org") but get the following message: Package which is only available in source form,

R - Loading External Indicators into Quantstrat

╄→гoц情女王★ 提交于 2019-12-03 07:14:13
I noticed that Quantstrat typically takes indicators that are based on price. However, I would like to load several indicators that have been externally calculated along with the price data. For instance, I have 2 extra columns in a csv file that contain my indicators (numbered 1-9). I want to generate a signal based on the numbers in these columns. Thus far, I have been unable to get Quantstrat to read the columns in the csv file. I've attached my code below: library(quantmod) library(quantstrat) library(PerformanceAnalytics) library(foreach) library(FinancialInstrument) getSymbols("SPY",

Combining shiny with Quantstrat backtests

大兔子大兔子 提交于 2019-12-02 10:32:53
问题 I am trying to make a web app with the intention of using quantstrat. However I am having a bit of difficulty integrating the two. There is no documentation on this so it's tough to find a place to start. Here is the code I have right now. It would be much appreciated if you could let me know what I am doing wrong. Thank you library(shiny) library(devtools) library(quantmod) library(quantstrat) library(TTR) library(png) library(dplyr) Sys.setenv(TZ = "UTC") currency('USD') ui <- fluidPage( #

quantstrat: how to create multiple indicators, signal rules

放肆的年华 提交于 2019-12-02 09:48:11
问题 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? 回答1: 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: sigFormula uses