Questions tagged [quantstrat]

quantstrat is a quantitative strategy framework for R

quantstrat (an R package) provides a generic infrastructure to model and backtest signal-based quantitative trading strategies. It is a high-level abstraction layer (built on the R packages xts, FinancialInstrument, blotter, etc.) that allows you to build and test strategies in very few lines of code. quantstrat is still under development but is used on real portfolios.

The latest codebase for quantstrat and blotter is at:

https://github.com/braverock/quantstrat

https://github.com/braverock/blotter

274 questions
0
votes
1 answer

R quantstrat: no transactions done despite all the signals

Below is the reproducible code: library(quantstrat) start_date <- as.Date("2017-02-02") end_date <- as.Date("2018-06-24") init_date <- as.Date("2017-01-01") init_equity <- "50000" adjustment <- TRUE symbol <- "PETR4.SA" getSymbols(symbol, src =…
Alan Alves
  • 61
  • 1
  • 2
  • 9
0
votes
2 answers

R quantstrat: Note: no visible binding for '<<-' assignment to '.strategy'

I installed R package quantstrat and its depencies as in the following code, as answered in this…
Alan Alves
  • 61
  • 1
  • 2
  • 9
0
votes
0 answers

Un- and Reinstall Quantstrat for new and clean setup R

I’ve been working with Quantstrat for the last 3 weeks and trying to understand ever step the functions takes and how it uses the different environments. In this learning process, I played around with the code a lot. Now I got to a point where my…
0
votes
1 answer

Quantstrat Trading Strategy inital equity Consideration

I have a problem with my quantstrat trading strategy. The Result of the Endequity doesnt consider my init_equity of 100000. If i change the init_equity to 100 i get the same Endequity. My code looks like this. Can someone imagine were my problem is?…
Ramon
  • 71
  • 8
0
votes
1 answer

quantstrat trading strategy with two Symbols. SIgnals in one, buy with prices in another symbol

Is it possible to set up a trading strategy in R using one Symbol (for example QQQ) to generate Signals but buy/sell another Symbol (for example QLD) ? The tradingstrategy with the QQQ is already made, how can i include the quotes of the QLD for…
Ramon
  • 71
  • 8
0
votes
0 answers

R: Bizarre Behavior with XTS objects

EDIT(1): This is the sessionInfo(): > sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17134) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 [2]…
Sean Sinykin
  • 542
  • 4
  • 22
0
votes
1 answer

Quantstrat: Ordersize function

I'm new to R and I'm trying to figure out how to get quantstrat to work with a custom ordersize function. The idea is to always invest all available equity in Bitcoin so that it will be comparable to a B&H strategy. I have provided reproducible…
0
votes
0 answers

quantstrat_0.10.7 warning message: .updatePosPL / Modifies end results

I was previously using quantsrat_0.9.1739 & blotter_0.9.1741 for some time and it worked fine until I updated them to the latest version 0.10.7 with blotter 0.12.4. Most of the simulations that I previously wrote throw in the following message:…
0
votes
2 answers

Instrument objects in R's `FinancialInstrument` package. `ls(envir=FinancialInstrument:::.instrument)`

I'd like to load one of my xts object as financial instrument in my environment (vs. getting the symbols from yahoo, google, etc) but I can't. My xts is a EURUSD daily OHLC series. ls(envir=FinancialInstrument:::.instrument) is giving me : [1] "IWM"…
Olivier.S
  • 15
  • 5
0
votes
1 answer

Issues installing quantstrat for version 3.4.2

I am trying to install the quantstrat package in R. I already installed the other packages necessary for quantstrat, below is my session info. sessionInfo() R version 3.4.2 (2017-09-28) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under:…
Augusto
  • 51
  • 1
  • 6
0
votes
0 answers

Quantstrat: applySignals error message

I would like to check a strategy using the quantstrat. The strategy will use a custom indicator as a signal. After the initial setup, signals and rules definitions then I called the function 'applySignals' that returned the following error (last…
0
votes
1 answer

Warning in for loop

My for loop is not working properly. I have the following warning message: imaginary parts discarded in coercion. What is the fix for this issue? Also, is there any way to make my code more efficient or have better style? # Load…
0
votes
2 answers

R: Quantstrat - Guy Yollin example - error message

I tried to run the following code library(quantstrat) library(blotter) search() currency("USD") stock("SPY", currency = "USD", multiplier = 1) ls(envir = FinancialInstrument:::.instrument) ls(all=T) initDate <- '1997-12-31' startDate <-…
boniface316
  • 489
  • 3
  • 17
0
votes
0 answers

Quantstrat / Blotter dims error when running Trade Statistics

There is an xts object generated from a txt file. It contains 5 rows: Open, High, Low, Close, S_Base. S_Base is a binary signal which is TRUE (equal to 1) when Low = Close. Thought to make a minimum reproducible example of 55 rows. It has 4 TRUE…
Krug
  • 1,003
  • 13
  • 33
0
votes
1 answer

Quantstrat won't work with ADX

I'm running an R quantstrat based script, taken from Backtesting Strategies with R). It works. Until I add ADX as an indicator and signal. If so, then I get the following error: Error in `colnames<-`(`*tmp*`, value = "ADXsig") : length of…
Krug
  • 1,003
  • 13
  • 33