Questions tagged [quantstrat]

quantstrat is a quantitative strategy framework for R

0
votes
0answers
13 views

How to use sigPeak() function in quantstrat

I cannot grasp how to properly use sigPeak() in quanstrat. A (not working) example follows. I add an indicator to mktdata: add.indicator(strategy = name, name ='WinDoPar', ...
0
votes
0answers
13 views

Position Sizing in Quantstrat based on symbol rank?

I am trying to create an algorithm that trades based on relative rankings. I.e, if Google is ranked #1, buy $100,000 at the start of the week and sell at the end. If Google is ranked #2, buy $50,000 ...
0
votes
1answer
65 views

Blotter cannot be loaded in r 3.5.1

I was able to use blotter and run quantstrat fine with previous r version However, I have updated R vesion to 3.5.1 and when I load blotter I receive this msg when loading blotter: "Error: package ...
-2
votes
1answer
62 views

Tried Everying, Searched Everything, Issues installing Quantstrat package from Github

Installing Quantstrat Issues. I am running the latest versions of R, RStudio, and Rtools. I have installed devtools / remotes packages and cannot seem to get quantstrat installed. enter image ...
0
votes
1answer
45 views

R / quantstrat / applyStrategy

Please ignore my previous post. I'm trying to run a trade strategy in quanstrat and I'm getting stuck. Any help would be greatly appreciated. The code is below and I receive the following error when I ...
2
votes
1answer
81 views

Netting transactions in quantstrat

Let's say I have a strategy with multiple rules that generates multiple orders on the same symbol at the same timestamp. For example, on 2012-05-23 one rule might buy 10 shares of IBM while another ...
1
vote
1answer
43 views

Negative cumulative returns and positive mean?

I have an issue with the results I get through quantstrat in R. I run a code for a trading strategy that provides positive daily mean returns as: > mean(rets) [1] 0.004187857 Sum of returns, as a ...
1
vote
1answer
36 views

No transactions/positions to Chart Quantstrat, “logical” error?

I get the error message that the are no transactions/positions to chart despite the use of signals and rules. Can someone explain me what I am doing wrong? Is it maybe in the logical development of ...
0
votes
1answer
288 views

Error attempt to set 'colnames' on an object with less than two dimensions

I will try to be as clear as possible as I have been rebuked by some users. I deleted the last questions and I will try to be sufficiently explicative in this one. I apologize if the data I will ...
0
votes
1answer
48 views

Quantstrat RStudio R Mac

I am trying to install the package Quantstrat on a Mac. I searched for help in internet but I did not find a solution. I already tried: require(devtools) install_github("braverock/quantstrat") The ...
0
votes
1answer
43 views

Bollinger Bands indicator in R

I am currently trying to write a simple strategy using Bollinger Bands in R. The goal is to enter a long position when the closing price touches the lower band and exit when it touches the upper one. ...
0
votes
1answer
38 views

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" ...
0
votes
2answers
41 views

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 link: install.packages("devtools") require(devtools) install_github("braverock/FinancialInstrument") ...
0
votes
0answers
34 views

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 ...
-1
votes
1answer
34 views

R with no transactions/positions to chart

I am working on blotter and quantstrat. I am wondering why there is an error info that keep showing no transactions/positions to chart. Could you please offer me some help? #### Set up packages we ...
0
votes
2answers
44 views

Quantstrat Naming of accounts and portfolios

I'm relatively new to R, and very new to quantstrat/blotter. In all of the examples I've seen, a string is loaded into a porfolio and account (portfolio.st, account.st). What is the purpose of this? ...
2
votes
1answer
39 views

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 ...
3
votes
1answer
43 views

Cannot make stoplimit orders work in quantstrat

Reproducible code: package <- c("compiler", "quantmod", "dygraphs", "plyr", "devtools", "PerformanceAnalytics", "...
1
vote
1answer
46 views

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 ...
0
votes
0answers
62 views

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 ...
0
votes
0answers
33 views

add.indicator DonchianChannel

I want to use the donchian Channel as an indicator/signal/rule I'm able to compute the donchian channel with ttr > tail(donchian) high mid low 2017-12-21 158.77 ...
3
votes
1answer
136 views

Trading Strategy in R using Donchian Channel

I want to set up a trading strategy using quantstrat. It should compare, if the closeprice is higher than the Donchianchannel high. i would like to create a Longsignal if: Closeprice > 0.85 * ...
1
vote
1answer
81 views

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 ...
1
vote
1answer
49 views

Quantstrat Trade Statistics yielding -100% cumulative returns?

I use tradestatistics on Quantstrat and obtained positive ending equities that look out of this world (starting equity=1m). However, what is puzzling is, cumulative returns is -1.0 when I tabulate ...
2
votes
1answer
43 views

Error in applying rules: Combined Technical indicator

I tried to combine a couple of EMAs and RSI together in quantstrat. Eventually, my objective is to generate some graphs and performance of the trading strategy. Unfortunately, I seem to be stuck in ...
-5
votes
1answer
69 views

Query in back-testing strategy in R- Indian trader perspective

There is a documentation for backtesting in R in GitHub(https://timtrice.github.io/backtesting-strategies/). I have a query in two lines of code mentioned in this document (https://timtrice.github....
0
votes
2answers
192 views

quantstrat: how to create multiple indicators, signal rules

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?
2
votes
2answers
115 views

How to Write a Custom Rule Function for Quantstrat in R - Replace trailing stop order with stoplimit with ruleOrderProc

My goal is to use the rule that I outline below to generate a signal to place a new 'stoplimit' order that replaces my trailing stop. I don't want my stop to trail indefinitely, only until it reaches ...
2
votes
1answer
163 views

Parameter Optimization with Custom indicators - Quantstrat

I am looking for examples of Parameter optimization codes in Quantstrat when using custom indicators. Most of the examples I can find online use SMA, MACD and other classic indicators. It doesn't help ...
2
votes
1answer
76 views

Quantstrat: Is it possible to execute several orders for the same instrument within a single day?

I'm a bit puzzled with how exactly Quantstrat places orders if they are generated within a single day by several signals. I'm trying to implement a simple pair-trading strategy (with zero being both ...
3
votes
1answer
90 views

Log chart in blotter function chart.Posn() possible?

Is it possible to draw a log price chart in the chart.Posn() or chart.Reconcile() functions of blotter? I tried adding log.scale = TRUE to the function call without success. Is the underlying ...
0
votes
0answers
70 views

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 ...
1
vote
2answers
43 views

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=...
0
votes
1answer
268 views

Cryptocurrency bitcoin back testing returns [closed]

I want to know the USD returns while back testing crypto pairs. For example backtesting BTC_ETH will show returns in BTC, but i want the relative USD returns. (as USD_BTC will be changing over the ...
1
vote
0answers
60 views

QuantStrat signals and orders in R

I have Bid-Ask ticks for these 3 isins. I have imported this data and converted to xts objects (I think this part is right). Now I have to add my buy/sell signals and orders. In this case I have a a ...
1
vote
0answers
112 views

No Pyramiding and Custom order sizing function in Quantstrat

The solution provided here from a previous question works perfectly, as long as a numeric value is assigned to orderqty in the "add.rule" section. What if I want to combine : - A custom order sizing ...
3
votes
0answers
121 views

Load data.table in QuantMod & Quantstrat

I have a data.table with my own data prices for 3 Isins. PricesDir="C:/Downloads/Prices" #With 10 CSVs just with bid-ask info. files=list.files(PricesDir, pattern="*csv",full.names = TRUE) prices = ...
3
votes
1answer
149 views

saving and loading blotter portfolio

I am using blotter to hold and do the accounting of some transactions, but I would need to save and load them on a daily basis. I haven´t been able to save my transactions, I believe that that ...
0
votes
0answers
130 views

R Quantstrat walk.forward Error

I'm trying to run Ilya's Kipnis Cycle RSI example, I added some parameter distribution on his code. When running walk.forward most of times I got this error: Error in addTxn(Portfolio = portfolio, ...
-3
votes
2answers
92 views

Comparing the High and Low from one day to the previous

I am trying to make and indicator to use in my quantstrat backtest but can't seem to figure out how to write it. Basically I want to compare the High and Low from 2 days ago to the H&L from 3 days ...
0
votes
1answer
443 views

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: ...
2
votes
1answer
160 views

How to get current “symbol” inside custom function when applyIndicators or applyStrategy in quantstrat

i would like to access the current symbol string eg "GOOG" inside my custom indicator function. Here is the most basic example i could make. require(quantstrat) Sys.setenv(TZ="UTC") symbols <- c("...
-2
votes
1answer
109 views

Calculate average return of strategy

Scenario (using quantstrat, blotter and portfolioanalytics) I have 10k initial equity I have a strategy that i want to backtest over 3000 symbol universe (stocks) Let say the strategy is a simple MA ...
4
votes
1answer
157 views

Quantstrat: Backtesting custom 'bollinger band' like strategy

I'm new with quantstrat and I would like to use then to simulate my strategy that essentially is a Bollinger Band. My code isn't working to close the open position when the Premium crosses the Avg. ...
0
votes
0answers
56 views

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 '...
1
vote
0answers
51 views

[quantstrat for multi instrument strategy]

how do you implement a strategy with multi instruments. for ex: a multi symbol rotation strategy base on the instrument with the highest momentum. apply.strategy does not work for multi instrument ...
2
votes
1answer
64 views

Quantstrat: Trading ticker X based on signal in ticker Y

I can't figure out how I can backtest a strategy trading ticker X and ticker Y based on a signal from a synthetic asset created from a combination of ticker X and Y. The data background is a list of ...
1
vote
1answer
106 views

Portfolio optimization using quantstrat

I would like to backtest a portfolio of assets whose weights are mean-variance optimized. I have seem examples here and here but all the examples are either dealing with fixed orderSize/tradeSize or ...
1
vote
1answer
70 views

XTS-File doesnt work for quantstrat

I have created an xts file out of a csv file which looks like this: open high low close volume adjusted 2016-01-04 14:30:36 "4896,3818" "4896,...
1
vote
1answer
268 views

problems in quantstrat : argument “price” is missing, with no default

I am a new user trying to backtesting on quantstrat, when I run the following code shows the message at the bottom. Can anyone help me to fix it? library(quantmod) initdate ="1999-01-01" from ="...