The Application downloads share price data from Yahoo Finance and uses the data to plot a Candle stick chart with Relative Strength Index (RSI) Indicator.
Interpretation of RSI:
a) RSI falls into Oversold Category if it falls below 30%
b) RSI falls into Overbought Category if it raises above 70%
c) The RSI calculates average price gains and losses over a given period of time; the default time period is 14 periods with values bounded from 0 to 100.
Just Copy & Paste the code in R Shiny App in R Studio as App.R or separately ui in ui.R and server in server.R
Please be careful in regards to indentation.
R Shiny Application Link: https://krpresearch.shinyapps.io/stockprediction/
R Shiny App Code:
Interpretation of RSI:
a) RSI falls into Oversold Category if it falls below 30%
b) RSI falls into Overbought Category if it raises above 70%
c) The RSI calculates average price gains and losses over a given period of time; the default time period is 14 periods with values bounded from 0 to 100.
Just Copy & Paste the code in R Shiny App in R Studio as App.R or separately ui in ui.R and server in server.R
Please be careful in regards to indentation.
R Shiny Application Link: https://krpresearch.shinyapps.io/stockprediction/
R Shiny App Code:
library(shiny)
library(quantmod)
library(fpp)
ui=fluidPage(
titlePanel("StockPrediction"),
sidebarLayout(
sidebarPanel(
helpText("Select Ticker Yahoo Finance"),
textInput("symb","Symbol","GOOG"),
dateRangeInput("dates",
"Date Range",
start="2007-01-01",
end=as.character(Sys.Date())),
br(),
br()
),
mainPanel(plotOutput("technical"),plotOutput("summary"))
)
)
server=function(input,output){
dataInput=reactive({
getSymbols(input$symb,from=input$dates[1],
to=input$dates[2],auto.assign = F)
})
output$technical=renderPlot({
data=dataInput()
chartSeries(data,type="candlesticks")
addBBands()
addRSI()
})
output$summary=renderPlot({
datadf=as.data.frame(dataInput())
dataclose=datadf[,4]
dataclose=na.omit(dataclose)
fit=auto.arima(ts(dataclose,frequency = 7),D=1)
summary(fit)
plot(forecast(fit,h=50))
})
}
shinyApp(ui=ui,server=server)
No comments:
Post a Comment