Hello,

I am a new user. I have a problem when I try to plot the forecast of the price of a stock for the next years.

For example Amazon.

The code that I am using is:

```
AMAZON1 <- getSymbols(Symbols = "AMZN", src = "yahoo", from = Sys.Date() - 1953,
to = Sys.Date(), auto.assign = FALSE)
AMAZON1 <- Cl(AMAZON1)
AMAZON <- na.omit(AMAZON1)
chart_Series(AMAZON, col = "black")
add_SMA(n = 100, on = 1, col = "red")
add_SMA(n = 20, on = 1, col = "black")
add_RSI(n = 14, maType = "SMA")
add_BBands(n = 20, maType = "SMA", sd = 1, on = -1)
add_MACD(fast = 12, slow = 25, signal = 9, maType = "SMA", histogram = TRUE)
AMAZON_LOG <- log(AMAZON)
head(AMAZON_LOG, n = 10)
plot(AMAZON_LOG, main = "log AMAZON chart")
ACF_AMAZON_LOG <- acf(AMAZON_LOG, lag.max = 320)
PACF_AMAZON_LOG <- pacf(AMAZON_LOG, lag.max = 320)
### difference logged data
AMAZON_DIFF <- diff(AMAZON_LOG, lag = 1)
AMAZON_DIFF <- na.locf(AMAZON_DIFF, na.rm = TRUE,
fromLast = TRUE)
plot(AMAZON_DIFF)
AMAZONDIFF.acf <- acf(AMAZON_DIFF)
AMAZONDIFF.pacf <- pacf(AMAZON_DIFF)
### splitting into train and test data
library(caTools)
train_data <- AMAZON_DIFF[1:1270]
### 2015/01/06 - 2020/01/13 (1270 obs.)
library(forecast)
set.seed(123)
arima_model <- auto.arima(train_data, stationary = TRUE, ic = c("aicc", "aic", "bic"),
trace = TRUE)
summary(arima_model) ###summary for choosen best arima(p,d,q) model
checkresiduals(arima_model) ###diagnostic cheking
arima <- arima(train_data, order = c(2, 0, 4))
summary(arima)
forecast1 <- forecast(arima, h = 100)
plot(forecast1)
checkresiduals(arima)
arima <- arima(indf_log[1:1270], order = c(2, 1, 4))
summary(arima)
forecast_ori <- forecast(arima, h = 100)
a <- ts(AMAZON_LOG)
forecast_ori %>% autoplot() + autolayer(a)
```

To sum up, I thing that the problem is the next fragment of the code

```
forecast_ori <- forecast(arima, h = 100)
a <- ts(AMAZON_LOG)
forecast_ori %>% autoplot() + autolayer(a)
```

When I use this code, the result is the next:

It plot de historical price but no the forecast.

Can you help me please?

Do you have another code to forecast the same stock using model GARCH?

Thanks