Why the quantmod chartseries() only show the last added SMA in Shinyapp?

17 Views Asked by At

As I make a page to show stock chart in Shinyapp, only the last added SMA n=20 line show up. I want to it shows all 3 SMA N=5,10,20. please see the online page https://konglr.shinyapps.io/Stock_Price_Prediction/

secondly, if the code run local without shinyapp, it works well as all the SAM showed up.

# Plot data
plot_type <- switch(input$plot_type,
                    "line" = "line",
                    "bars" = "bars",
                    "candlesticks" = "candlesticks",
                    "matchsticks" = "matchsticks")

chartSeries(ticker_data(), type = plot_type, name= input$ticker, theme = "white",
            subset = paste("last",input$period, "day",sep = " "))
addSMA(n=5,  col = "brown")
addSMA(n=10, col = "purple")
addSMA(n=20, col = "orange") })
0

There are 0 best solutions below