ARIMA Stock Price Prediction is very bad [closed]

I'm learning about time series forecasting and I decided to try to model the Google stock price using Python and Statsmodel, I collected data from 1st of January 2010 upto this month.

Then I tried to use an ARIMA model for the closing price which is non stationary with an order of (3,1,0) and other orders ( I tried several orders)

But the problem is that the results are extremely far from the actual test data, here is the code I'm using to build the arima model:

from statsmodels.tsa.arima_model import ARIMA

arima_model = ARIMA(close_train,order=(4,1,10))
arima_pred = arima_model.fit().predict(start=size,end=len(data)-1)


Then I'm plotting arima_pred next to close_test which is the test set for closing prices (I'm using an 80% split) and I'm getting this plot:

The green part are the actual closing prices from the test data,the blue are actuale prices from training data and the predictions are in orange.

As you can see, the ARIMA predictions are very far, I've tried several orders and they are all look very far, I think that I'm doing something wrong here.

I have also tried an Auto ARIMA model which suggests to use SARIMAX, the plot is not that great though (even much better than ARIMA)

• you don't simultaneously predict 30 steps out. you predict-train-predict one step at a time. It isn't good, but should be a little less bad. – EngrStudent Mar 29 at 19:21
• I’m voting to close this question because it's off topic. All stock price prediction to be sent to quant.stackexchange.com – Aksakal Mar 29 at 19:49

The first set of predictions are all 0, which is what you would get if the model lacked historical data, or thought that historical data values were all 0, regardless of model form.

• Thank you, but how can that happen ? I'm quite a beginner in this field and I'm a little bit clueless, if you could elaborate that would be very helpful, thank you ! – Souames Apr 18 '20 at 19:26
• It must be a syntax error. I'm sorry, but I don't use this package. Check the documentation for an option that specifies the data used to forecast. You might try cutting the data off at a different point, to see if the same thing happens. Good luck. – Ed Rigdon Apr 18 '20 at 20:01
• If everything could be predicted perfectly then analyst would not make fortunes in stock markets. I use many models to predict our much simpler data and still none are ever perfect - if I am within 5 percent I am happy. A suggestion I think is useful is to run more than one model (including exponential smoothing models and ARIMA, and average them. I run 5 exponential smoothing models, chose the best three for the last year with a MAPE and then predict with that (and am adding an ARIMA results). – user54285 Apr 18 '20 at 22:42
• @user54285 in equity markets if you can predict stock prices within 5% unbiased you’d make a fortune through leverage. Reality is that this series cannot be predicted with any precision. – Aksakal Mar 30 at 13:38

Stock prices are the worst kind of a toy problem to train yourself on when studying time series. The simple reason: they're essentially unpredictable. At least the kind of the series you are using in the time frame that you chose. Just think logically: if the price series were predictable why wouldn't everyone predict them and make money? See what Fama got Nobel prize for: "Eugene Fama demonstrated that stock price movements are impossible to predict in the short-term."

It's better to take on something that can be predicted when you're learning the tools, e.g. airline ticket sales or temperature.

Given the volatility in a stock market time series ARIMA, is not an appropriate technique. If you really want to model the volatility in stock market data try GARCH instead.

If you want to learn about Time series forecasting I suggest picking up the Box-Jenkins book on the subject.

• you must be a millionaire, if you can predict GOOGL stock price with GARCH, or, for that matter, with anything at all. if you're not then why are you wasting your time here? just go make a few millions and never come back – Aksakal Mar 29 at 19:48
• @Jonathan Dunne, The question is not about volatility modeling. GARCHs are off topic. – markowitz Mar 29 at 19:57

Your prediction look like made by a random walk with drift model, Indeed the graph sound like it. Your result are quite usual. You do not make serious mistake, is not possible to find a much better ARIMA specification.

However is crucial to understand the main points of the problem, read here: Forecasting Prices vs Returns by Deep Learning