quantstrat

Combining shiny with Quantstrat backtests

痴心易碎 提交于 2019-12-02 05:19:34
I am trying to make a web app with the intention of using quantstrat. However I am having a bit of difficulty integrating the two. There is no documentation on this so it's tough to find a place to start. Here is the code I have right now. It would be much appreciated if you could let me know what I am doing wrong. Thank you library(shiny) library(devtools) library(quantmod) library(quantstrat) library(TTR) library(png) library(dplyr) Sys.setenv(TZ = "UTC") currency('USD') ui <- fluidPage( # Application title titlePanel("myfirst"), sidebarLayout( sidebarPanel( selectInput( "stocks", label =

Convert from R to quantstrat setup for trading strategy backtesting

老子叫甜甜 提交于 2019-11-30 16:57:55
I am trying to backtest a trading strategy with "quantstrat" package. My strategy is composed by 4 indicators, 3 different EMAs and 1 lagged EMA. I want to go long when: EMA1 > EMA2 & EMA1 > EMA3 & EMA1_lag < EMA1 I want to exit and go flat when: EMA1 < EMA3 It's pretty simple but I am not able to write it into quantstrat environment. Here's a data integrity check function used in both examples: # Data integrity check checkBlotterUpdate <- function(port.st,account.st,verbose=TRUE) { ok <- TRUE p <- getPortfolio(port.st) a <- getAccount(account.st) syms <- names(p$symbols) port.tot <- sum

Guy Yollin's QuantStrat I lecture issue

最后都变了- 提交于 2019-11-30 07:43:45
I've been going through Guy's quantstrat lecture (link below) and after repeatedly attempting to re-execute the code, I'm getting a few initial errors that are preventing most of the subsequent code in the lecture from functioning. Here is the code (copied from the lecture with very minor re-arrangements): rm(list=ls(all=TRUE)) #added this to delete memory library(quantstrat) library(blotter) #added this hoping it would rectify the errors library(FinancialInstrument) #added this hoping it would rectify the errors # initialize portfolio, accounts and orders qs.strategy <- "qsFaber" initPortf(qs

Guy Yollin's QuantStrat I lecture issue

巧了我就是萌 提交于 2019-11-29 10:24:54
问题 I've been going through Guy's quantstrat lecture (link below) and after repeatedly attempting to re-execute the code, I'm getting a few initial errors that are preventing most of the subsequent code in the lecture from functioning. Here is the code (copied from the lecture with very minor re-arrangements): rm(list=ls(all=TRUE)) #added this to delete memory library(quantstrat) library(blotter) #added this hoping it would rectify the errors library(FinancialInstrument) #added this hoping it