quantstrat

Generating indicators of different periodicity in quantstrat

余生长醉 提交于 2019-12-20 02:15:59
问题 I would like to use indicators of timeframes different to the data I am using. I have seen this asked a few time but no solutions as of yet (at least for me anyway). The below example uses daily stock data however the actual project uses intraday currency data. I have an easy work around for importing the intraday csv data now so the example and real-world should be interchangeable enough. library(quantstrat) initDate="2000-01-01" from="2003-01-01" to="2016-12-31" #set account currency and

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

与世无争的帅哥 提交于 2019-12-14 03:27:49
问题 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 description here 回答1: I had similar problems too. Installing quantstrat via cmd works well for me. Here are the steps: Create a folder for packages i.e RPackages\ Download the file from github to that specific folder and extract the files to the library name. i.e RPackages\quantstrat\ go on command line

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

会有一股神秘感。 提交于 2019-12-13 05:09:16
问题 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") install_github("joshuaulrich/xts") install_github("braverock/blotter") install_github("braverock/quantstrat") install_github("braverock/PerformanceAnalytics") When installing quantstrat package, I got the following output: Note: no visible binding for '<<-' assignment to '.strategy' Note: no

R: Quantstrat examples of Guy Yollin. Indicators necessary? And what is stored in these financial instruments?

隐身守侯 提交于 2019-12-13 05:06:45
问题 Hi I'm working through this code (this works and is reproducible) if (!exists('.blotter')) .blotter <- new.env() if (!exists('.strategy')) .strategy <- new.env() if (!exists('.instrument')) .instrument <- new.env() currency("USD") stock("SPY",currency="USD",multiplier=1) ls(envir=FinancialInstrument:::.instrument) initDate <- '1997-12-31' startDate <- '1998-01-01' endDate <- '2013-07-31' initEq <- 1e6 Sys.setenv(TZ="UTC") getSymbols('SPY', from=startDate, to=endDate, adjust=T) SPY=to.monthly

Add Technical Indicator to chart.Posn

烈酒焚心 提交于 2019-12-12 12:54:51
问题 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 = 'SPY', Dates = '1998::',theme=myTheme) chart.Posn(strategy_AbsMom, Symbol = 'SPY', Dates = '1998::',theme=myTheme, TA='addROC(n=lookback,col=4)') 回答1: chart.Posn uses chart_Series (not chartSeries ) internally, so you have to use add_* functions (not

Installing blotter and quantstrat on GitHub

China☆狼群 提交于 2019-12-12 09:18:28
问题 I am experiencing a hard time in installing the blotter and quantstrat packages from Github. Most helps I can find online are quite outdated issued back then when they are hosted on sourceforge. I try to use the install_github() function and it returns error below. (In fact there is similar error when I try R-Forge) Can anyone provide a clue on what is happening here? install_github("braverock/blotter") Downloading GitHub repo braverock/blotter@master from URL https://api.github.com/repos

Upgraded quantstrat 0.7.8 from 0.7.7 then old code does not work

 ̄綄美尐妖づ 提交于 2019-12-11 19:17:52
问题 I have upgraded quantstrat package from 0.7.7(installed on Jan 7th 2013) to 0.7.8, however old code does not work properly. looks like we can not put any entry orders niether buy or sell, and only exit orders are executed. Here is the detail. Someone knows major changes in add.rule or applyStrategy function or same issue has been reported? We set up trading rule by add.rule() add.rule(f,'ruleSignal',arguments=list(sigcol="DoSell",sigval=TRUE,orderqty=(-1*tradeSize),osFUN='osSUS',ordertype=

Warning in quantstrat

五迷三道 提交于 2019-12-11 12:11:51
问题 Here is my code: library(quantstrat) suppressWarnings(try(rm(list=ls(FinancialInstrument:::.instrument),pos=FinancialInstrument:::.instrument),silent=TRUE)) currency("EUR") stock("ATX",currency="EUR",multiplier=1) ls(envir=FinancialInstrument:::.instrument) ls(all=T) initDate <- '1999-01-04' startDate <- '1999-01-05' endDate <- '2014-09-25' initEq <- 1e6 Sys.setenv(TZ="UTC") ## ----echo=FALSE,results='hide'------------------------------------------- if(file.exists("ATX.RData")) { load("ATX

R - Quantstrat - back testing is not working

一笑奈何 提交于 2019-12-11 07:25:24
问题 I used the following code from Guy Yollin's lecture. The result I got was not correct. The result is posted below the code. library(blotter) library(quantstrat) currency("USD") stock("SPY", currency = "USD", multiplier = 1) initDate = "1997-12-31" startDate = "1998-01-01" endDate = "2014-06-30" initEQ = 1e6 Sys.setenv(TZ = "UTC") getSymbols('SPY', from = startDate, to = endDate, index.class = "POSIXct", adjust = T) SPY = to.monthly(SPY, indexAt = "endof", drop.time = FALSE) SPY$SMA10m <- SMA

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

我是研究僧i 提交于 2019-12-11 06:47:23
问题 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 my breakeven price (if this can be achieved somehow already, please let me know). I am hoping to write a custom rule in quantstrat with the following objective: If today's "Close" minus (-) the threshold value (a scalar) on the timestamp of trade open, is greater than (>) the "Open" price on