Menu
  • HOME
  • TAGS

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

r,quantstrat

You can add allowMagicalThinking=TRUE to your call to applyRules. If you add allowMagicalThinking=TRUE to your call to applyStrategy, it will be passed to applyRules.

Quantstrat and Windows

r,quantstrat,blotter

The solution was: I downloaded the .zip version of quantstrat and blotter (currently both are 3.1.3) and both installed successfully. Interesting.

Loading intraday data into R for handling it with quantmod

r,csv,quantmod,yahoo-finance,quantstrat

I don't know how to do this without "reinventing the wheel" because I'm not aware of any existing solutions. It's pretty easy to do with a custom function though. intradataYahoo <- function(symbol, ...) { # ensure xts is available stopifnot(require(xts)) # construct URL URL <- paste0("http://chartapi.finance.yahoo.com/instrument/1.0/", symbol, "/chartdata;type=quote;range=1d/csv") # read...

getSymbols with csv in Quantmod R

r,csv,quantmod,quantstrat

getsymbols.csv expects six columns: Open, High, Low, Close, Volume, Adjusted Your data does not have the "Adjusted" column; it has 5 column names instead of 6, which is causing the dimnames error you're seeing. If you can modify the local data files, try adding an empty "Adjusted" column (easily done...

Quanstrat strategy - error

r,quantstrat

Removing some columns from mktdata and moving the price column to the very left solved the issue.

R - FinancialInstrument Package Changing Symbol Names when using stock

r,xts,quantstrat,blotter

instrument names need to begin with a letter or a dot. The instrument function uses make.names to ensure this. If it's important to be able to find your instruments by a number, then you can add it as an identifier. stock("X1234", currency("USD"), identifiers=list(num=1234)) getInstrument("1234") #primary_id :"X1234" #currency :"USD" #multiplier :1...

R // QuantStrat package - hasTsp(x): invalid time series parameters specified Error

r,xts,quantstrat

Finally I have found an answer to my question. The problem is that strptime() converts my chart to POSIXlt time format. Apparently only POSIXct format is working. Therefore you just have to use as.POSIXct() to solve the problem. Modified example: as.POSIXct(strptime(GBPUSD$V2,"%Y%m%d %H:%M:%S"))....

Error implementing a stoplimit order in quantstrat

r,quantstrat,blotter

Your bitbucket code runs for me if I assign the output of add.rule and enable.rule back to pairStrat (as is done for all the other add.rule calls in the demo). # wrong add.rule(strategy=pairStrat, ...) enable.rule(pairStrat,'chain',"StopLoss_Long","StopLoss_Short") # correct pairStrat <- add.rule(strategy=pairStrat, ...) pairStrat <- enable.rule(pairStrat,'chain',"StopLoss_Long","StopLoss_Short") ...

Color option in xtsExtra

r,plot,xts,quantstrat

Q1. If you take time to read the help text for plot.xts, you see that the function does not have a col argument. Together with the fact that partial matching of argument names doesn't seem to be allowed in the function, it explains why plot.xts it does not respond col...

how to apply long only add.distribution parameterset in quantStrat - simpleError in param.combo[[param.label]]

r,quantstrat

This is the same bug as # 5776. It was fixed for "signal" component types, but not for "chain". It should now be fixed as of revision 1669 on R-Forge.

Can Quantstrat be used to generate orders for a production system

r,quantstrat

It's theoretically possible, but why would you want to? quantstrat is designed to make it easier to test ideas quickly and accurately. That's a very different problem domain than production trading. In short, use the right tool for the job. If you really want to go this route, you would...

Error in the pair_trade.R demo in quantsrat

r,quantstrat

The problem is the same issue reported in bug #5808, which has been fixed in r1681 on R-Forge. The issue was that match.fun(TxnFees) wasn't being called before transactions that cause the position to cross zero. So there would be an error, if TxnFees was a character string representing a function...

Optimizing Signal Parameters with Quantstrat results in error: attempt to select less than one element

r,parallel-processing,xts,quantmod,quantstrat

You need to add the position limit to your portfolio before you call apply.paramset. And you probably want to assign the output of apply.paramset to something. This worked for me using the latest revisions of blotter and quantstrat. addPosLimit(portfolio.st, 'XLF', timestamp=initDate, maxpos=500, minpos=0) ap <- apply.paramset(strategy.st, paramset.label='sigThreshold', portfolio.st=portfolio.st, account.st=account.st, nsamples=0)...