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
4
votes
3 answers

R: Quantstrat how to make a transaction for complete equity in portfolio?

I'm still playing around with Guy Yollins quantstrat example. In this example he buys 1000 shares of the SPY when it crosses its 10 day MA. Since we define an initial equity, is it possible to always buy for the whole portfolio amount and not just…
MichiZH
  • 5,587
  • 12
  • 41
  • 81
4
votes
1 answer

R - quantstrat orders cancel each other

How to enter orders that cancel each other in quantstrat? For example, once I enter a trade, I immediately open two orders: "stop loss" and "take profit". Once one gets filled, the other will be cancelled. #Enter signal strategy <-…
SilverSpoon
  • 655
  • 4
  • 8
  • 17
3
votes
1 answer

Stoplimit order when orderPrice crosses above/below Close of the bar in quantstrat?

I am trying put a stoplimit order to close my position when a specific order price crosses above or below the Close of the candle. My rule function as follows: add.rule(strategy = strategy.st, name = "ruleSignal",arguments = list(sigcol = "lenter",…
Serhat Akay
  • 115
  • 10
3
votes
1 answer

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. The algo logic that defines the strategy…
Jose Filho
  • 61
  • 3
3
votes
1 answer

Error with applyStrategy

I am new to R and have recently encountered the following error after running applyStrategy function from quantstrat package: Error in eval(expr, envir, enclos) : object 'signal' not found Error in `colnames<-`(`*tmp*`, value = integer(0)) : …
3
votes
0 answers

Multicurrency strategy - Blotter & Quantstrat

I would want to rebound on this thread http://r.789695.n4.nabble.com/Multi-currency-example-for-blotter-td1692132.html Basically, I'm backtesting a strategy using quantstrat where I have instruments in several currencies but I would want an…
NicolasB
  • 83
  • 5
3
votes
1 answer

Position sizing

I currently have my backtest set up so that it will invest 25% of my current equity. The problem this is causing is when my capital starts to grow the strategy starts taking on enormous trades. How do I specify for it do invest Equiuty*0.25 but only…
Cameron Giles
  • 72
  • 1
  • 8
3
votes
1 answer

R - Quantstart: Testing Strategy on Multiple Equities

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…
David
  • 31
  • 1
3
votes
0 answers

Multi symbols in Quantstrat

First, I would like to thank the community for the fantastic support and reactivity. I encounter a problem applying a simple MA crossover strategy on multi instruments. Basically, I maintain a database of csv price files. I retrieve these files…
NicolasB
  • 83
  • 5
3
votes
1 answer

Quantstrat Order Modification

Hi have a rule of type chain that will submit a limit order profit target upon entering a position. All very standard stuff so far, but how can I then modify this open order later on? Specifically, if (after a certain time delay) the signal that…
Ed Wilson
  • 267
  • 3
  • 12
3
votes
2 answers

QUANTSTRAT - How to build a strategy on a certain asset and use it on another one?

I am writing my MSc final dissertation and I am stuck trying to develop a trading strategy with the quantstrat package. What I would like to do is to trade the SPY looking at the signals generated by a MACD built on the VIX. I am struggle with…
matcava
  • 53
  • 8
3
votes
1 answer

Using externally provided indicator data for quantstrat

I am thinking about using R and quantstrat for backtesting some strategies. I have looked at some documentation and youtube videos to find out if it is possible to do what I want. I am completely new to R and I am willing to dive into the necessary…
3
votes
1 answer

Add Technical Indicator to chart.Posn

For some reason I cannot add a ROC signal to a blotter chart. In the documentation it should be allowed. I want to create a new chart bellow with this indicator. Can someone help? # plot performance for symbol chart.Posn(strategy_AbsMom, Symbol =…
husvar
  • 373
  • 1
  • 3
  • 13
3
votes
0 answers

Monthly Rebalancing in quantstrat

(I know this is a long and messy question, but I really hope someone can help me since I have been working on this supposingly simple stuff for about two weeks...) Two questions 1) In quantstrat, I find the function rulePctEquity that can be used…
Eric
  • 51
  • 4
3
votes
1 answer

Quantstrat Multiple Currencies. Possible Bug in Blotter::UpdateAcct?

General info: R-Version: 3.1.0 blotter: 0.8.19 Problem description: I am trying to implement a quantstrat account which uses multiple portofolios with different currencies. So here's my basic setup: 1 account in EUR 1 portfolio in USD So in order…
Buggy
  • 2,050
  • 21
  • 27
1
2
3
18 19