Je voudrais créer une application brillante pour montrer le graphique de la charte graphique. Cependant, il n'a pas montré le complot addTA. Je voudrais faire la fonction addTA de la fonction ChartSeries parce que je voulais les mettre en options, en dessous de son mon code:R addTA fonction dans Shiny App
ui.R:
library(shiny)
shinyUI(fluidPage(
titlePanel("Stock App"),
sidebarLayout(
sidebarPanel(
helpText("HK stock market."),
textInput("symb", h5("Symbol"), "0005.HK"),
radioButtons(inputId="period", label=h5("Periodicity"),
choices=c("daily","weekly","monthly")),
radioButtons(inputId="subset", label=h5("Time"),
choices=c("last 1 year","last 3 years","last 5 years")),
checkboxGroupInput("indicator",
label = h5("Indicators"),
choices = list("addBBands",
"Intraday Intensity",
"MFI", "Parabolic SAR"),
selected = "addBBands")
),
mainPanel(
textOutput("text3"),
br(),
plotOutput("plot")
))))
server.R
library(shiny)
library(quantmod)
shinyServer(function(input, output) {
output$text3 <- renderText({
paste("you have chosen a stock ", input$symb)
})
dataInput <- reactive({
getSymbols(input$symb, src = "yahoo",
auto.assign = FALSE, periodicity = input$period)
})
output$plot <- renderPlot({
chartSeries(dataInput(), theme = chartTheme("white"),
up.col = "green", dn.col = "red",
TA = NULL, name = input$symb, subset = input$subset)
addTA(SMA(Cl(na.omit(dataInput())),n=2), col="red", on = 1)
addTA(SMA(Cl(na.omit(dataInput())),n=19), col="blue", on = 1)
})
})
La fonction addTA n'a pas été générée, aucun conseil, merci.
Puis-je poser une autre question? Si je mets ces indicateurs dans le checkboxGroupInput, comment puis-je montrer les indicateurs quand j'ai cliqué? Je ne peux pas comprendre comment mettre l'indicateur d'entrée $ dans la fonction addTA. –
@Peter Chung Bien sûr, donnez un échantillon de code et je vais jeter un oeil (ou quelqu'un d'autre pourrait le faire). Devrait probablement être une autre question si – FXQuantTrader