Hi,
The current code uses a rolling window approach for backtesting. For example, with a year of daily data, it first trains on roughly January 1 to September 12 (70%) to predict September 13, then shifts forward to train on January 2 to September 13 to predict September 14, and so on. This creates a series of historical predictions to evaluate model performance.
To predict tomorrow’s price instead, you should train the ARIMA model once using all your historical data up to today, then use the forecast() function to generate a single prediction for tomorrow. Can you first try this on your end? If the idea is not clear or you run into issues, I will be happy to help.
In the dataset we are using in the notebook in Section 18 unit 11, we have data till 27-07-2020. We will be using this dataset to predict the close on 28-07-2020. Here is the code, Run it in the last cell of the notebook
# Use the full dataset to fit the ARIMA model
full_model = ARIMA(data['close'], order=(2, 1, 2))
full_model_fit = full_model.fit()
# Forecast the next period (day)
next_day_forecast = full_model_fit.forecast(steps=1)
print("\nNext Period Forecast:")
print(f"Predicted AUDUSD Price: {next_day_forecast.values[0]:.6f}")
# Calculate the forecast confidence interval
forecast_ci = full_model_fit.get_forecast(steps=1).conf_int(alpha=0.05)
lower_bound = forecast_ci.iloc[0, 0]
upper_bound = forecast_ci.iloc[0, 1]
print(f"95% Confidence Interval: [{lower_bound:.6f}, {upper_bound:.6f}]")
# Additional diagnostic information
print("\nModel Summary:")
print(full_model_fit.summary())