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
2 answers

Quantstrat: sell at next bar (custom)

I am working on modifying the built-in functions in quantstrat which are related to stop-limits. I want to test a system which sells only when closing price is below the stoplimit. I was able to change the comparison data so it sells when close <…
Saile
  • 115
  • 1
  • 11
0
votes
1 answer

modification for stoplimit type for ruleSignal

I wonder if anyone could help me modify my stoplimit (stop loss) rule. How can I change it to sell with close below limit price, rather than low below limit price? > #rules add.rule(strategy.st, name="ruleSignal", > …
Saile
  • 115
  • 1
  • 11
0
votes
0 answers

Finding maximum using apply and embed in R in Quantmod

hi i was looking at this website http://www.r-bloggers.com/backtesting-a-simple-stock-trading-strategy/ but I couldn't understand this code below: require(quantmod) getSymbols('^GSPC',from='1900-01-01') daysSinceHigh <- function(x, n){ …
이종연
  • 129
  • 1
  • 9
0
votes
0 answers

From loop to Quantstrat

I want to build a simple trading strategies using quantstrat. I am struggling because the results I had are different from the results of the strategy written without using the package. In particular this is the idea: I want to go long when: EMA1 >…
0
votes
1 answer

quantstrat addPosLimit() is not limiting my positions when going both long and short in the same strategy

When I have a strategy that goes both long and short and I have set the addPosLimit() function to have maxpos=1 and minpos=-1, It still takes more than one long and one short position. But if I make the strategy only long, or only short it works as…
GeV 126
  • 351
  • 1
  • 3
  • 14
0
votes
1 answer

Quantstrat logical error while running applySignals - missing value where TRUE/FALSE needed

I am having this error while running a strategy back-testing in the R, using Quantstrat package. Whenever, I try to use applySignals function to test the signals, it shows the logical error. I tried to remove the NAs by na.omit(FB) command, but when…
0
votes
0 answers

Cant install blotter package

Im at a complete loss and have tried several solutions suggested by others on StackOverflow. I struggled to install quanstrat and eventually managed to get thsi sorted out with @MrFlick's help. However, quanstrat needs the package blotter to be…
NMRQL
  • 65
  • 1
  • 6
0
votes
0 answers

Quantstrat in R

I am uploading quanstrat to R and want to run the demo package. However I am getting error messages when installing and the demo won't run either(see below). Do you have any suggestions on what I am doing wrong? Many thanks in…
NMRQL
  • 65
  • 1
  • 6
0
votes
1 answer

R Packages Blotter and Quantstrat: Extend framework to implement signal based on fundamental data?

I am looking for a way to extend Quantstrat in order to fetch data from bloomberg using the rbbg package and to backtest strategies based on indicators which are calculated using fundamental data. Is there any documentation on what's the best way to…
Ueli Hofstetter
  • 2,409
  • 4
  • 29
  • 52
0
votes
1 answer

Quantstrat error in instrument class constructor

HI i am tryning to copy the code from Ilya Kipnis's "Nuts and Bolts of quantstrat I". i loaded the following code: require(quantstrat) require(PerformanceAnalytics) initDate="1990-01-01" from="2003-01-01" to="2012-12-31" options(width=70) …
NMRQL
  • 65
  • 1
  • 6
0
votes
1 answer

debugging applyIndicators error in Quanstrat

Ran into an interesting error trying to learn quantstrat with the applyIndicators function. I have 3 indicators, lagATR, RSI, and SMA applied to the same data over the same period. All three indicators together generate an error using the…
rmacey
  • 599
  • 3
  • 22
0
votes
1 answer

R QUANTSTRAT - error when applying signal

I know this question has already been asked, but all answers posted here did not work for me. I do backtest one simple one indicator strategy but which ends up with following error: Error in .xts(e, .index(e1), .indexCLASS = indexClass(e1),…
Steef Gregor
  • 544
  • 1
  • 7
  • 21
0
votes
1 answer

Warnings in match.names quantstrat

I get some warnings when running my quantstrat code, for example one of them is: Warning messages: 1: In match.names(columns, colnames(data)) : all columns not located in Close SMA50 for AGG.Open AGG.High AGG.Low AGG.Close AGG.Volume AGG.Adjusted…
user1665355
  • 3,324
  • 8
  • 44
  • 84
0
votes
0 answers

Error in .xts(e, .index(e1) in quantstrat

I get an error when running my quantmod code: ´Error in .xts(e, .index(e1), .indexCLASS = indexClass(e1), .indexFORMAT = indexFormat(e1), : index length must match number of observations´ My code (partly from…
user1665355
  • 3,324
  • 8
  • 44
  • 84
0
votes
0 answers

Quantstrat Optimizing Parameters

I am trying to run the demo called macdParameters.R inside quantstrat but am running in to errors. Below is the exact code: error: > tPD2<-setParameterDistribution(type='indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast') Error in…
user1234440
  • 22,521
  • 18
  • 61
  • 103