Predictive Model Based on Machine Learning to Determine Gold Price Fluctuation and Improve Trading Decisions
Abstract
1. Introduction
2. Literature Review and Theoretical Framework
2.1. Determinants of Gold Price and Its Time-Series Properties
2.2. Machine Learning Approaches to Financial Forecasting
2.3. Machine Learning in Data-Rich Macro-Financial Environments
2.4. Granger Causality and the Correlation–Causation Distinction
3. Materials and Methods
3.1. Data Sources and Sample Period
3.2. Frequency and Sample Size
3.3. Stationarity Testing
3.4. Log-Return Transformation and Johansen Cointegration
3.5. Predictor Screening: Granger Causality, Multicollinearity, and Feature Sets
3.6. Multicollinearity (VIF)
3.7. Model Specification and Hyperparameter Selection
3.8. Temporal Validation: Train/Test Partition and Sensitivity Window
3.9. Naive Benchmarks and Forecast-Comparison Tests
3.10. Monte Carlo Simulation and Distributional Robustness
3.11. Structural Breaks and Long-Memory Diagnostics
3.12. Interpretability: SHAP Values and Partial Dependence
4. Results
4.1. Model Development, Selection, and Validation
4.2. Sensitivity to the Test-Window Length
4.3. Naive Benchmarks and Forecast-Comparison Tests Results
4.4. Production Model Fit over the Historical and Test Periods
4.5. Residual Diagnostics and Interpretability
4.6. Bootstrap Stability of the Cross-Validation Metric
4.7. Rolling-Window Evaluation and Volatility Diagnostics
4.8. Monte Carlo Forecast and Distributional Robustness
4.9. Sales-Timing Backtest
5. Discussion
5.1. Forecast Accuracy Without Overstated Trading Value
5.2. External Validity and the Global Nature of Gold Prices
5.3. On the Choice of Monthly Frequency and the Unchanged Title
6. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Banco Central de Reserva del Perú [BCRP]. (2025). Reporte de inflación, marzo 2025. Available online: https://www.bcrp.gob.pe/docs/Publicaciones/Reporte-Inflacion/2025/marzo/reporte-de-inflacion-marzo-2025.pdf (accessed on 12 January 2026).
- Bauer, M. D., & Hamilton, J. D. (2018). Robust bond risk premia. The Review of Financial Studies, 31(2), 399–448. [Google Scholar] [CrossRef] [Scilit]
- Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31(3), 307–327. [Google Scholar] [CrossRef] [Scilit]
- Box, G. E. P., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time series analysis: Forecasting and control (5th ed.). Wiley. Available online: https://www.wiley.com/en-us/Time+Series+Analysis:+Forecasting+and+Control,+5th+Edition-p-9781118675021 (accessed on 12 January 2026).
- Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5–32. [Google Scholar] [CrossRef] [Scilit]
- Brockwell, P. J., & Davis, R. A. (2016). Introduction to time series and forecasting (3rd ed.). Springer. [Google Scholar] [CrossRef] [Scilit]
- Caldara, D., & Iacoviello, M. (2022). Measuring geopolitical risk. American Economic Review, 112(4), 1194–1225. [Google Scholar] [CrossRef] [Scilit]
- Campbell, J. Y., & Thompson, S. B. (2008). Predicting excess stock returns out of sample: Can anything beat the historical average? The Review of Financial Studies, 21(4), 1509–1531. [Google Scholar] [CrossRef] [Scilit]
- Castillo, O. A. (2022). Desarrollo de modelos predictivos de regresión en la industria minera mediante el uso de algoritmo de machine learning [Bachelor’s thesis, Universidad Nacional Mayor de San Marcos]. Cybertesis UNMSM. Available online: https://cybertesis.unmsm.edu.pe/handle/20.500.12672/18458 (accessed on 13 January 2026).
- Clark, T. E., & West, K. D. (2007). Approximately normal tests for equal predictive accuracy in nested models. Journal of Econometrics, 138(1), 291–311. [Google Scholar] [CrossRef] [Scilit]
- Cohen, G., & Aiche, A. (2023). Forecasting gold price using machine learning methodologies. Chaos, Solitons & Fractals, 175, 114079. [Google Scholar] [CrossRef] [Scilit]
- Cont, R. (2001). Empirical properties of asset returns: Stylized facts and statistical issues. Quantitative Finance, 1(2), 223–236. [Google Scholar] [CrossRef]
- CooperAccion. (2024). La marcha de la economía y la minería. Available online: https://cooperaccion.org.pe/economia-y-mineria-20/ (accessed on 13 January 2026).
- Cotrina-Teatino, M. A., Riquelme Sandoval, A. I., Guartán Medina, J. A., & Marquina Araujo, J. J. (2025). Machine learning aplicado a la exploración minera usando matriz de confusión. Sciendo Ingenium, 21(1), 63–74. [Google Scholar] [CrossRef] [Scilit]
- Diaz-Hernandez, A., Ramírez Sánchez, J. C., & Salazar Flores, Y. (2020). Los determinantes de las variaciones en el rendimiento del oro. Contaduría y Administración, 65(2), e169. [Google Scholar] [CrossRef] [Scilit]
- Diebold, F. X. (2015). Forecasting in economics, business, finance and beyond. University of Pennsylvania. Available online: https://www.sas.upenn.edu/~fdiebold/Textbooks.html (accessed on 13 January 2026).
- Diebold, F. X., & Mariano, R. S. (1995). Comparing predictive accuracy. Journal of Business and Economic Statistics, 13(3), 253–263. [Google Scholar] [CrossRef] [Scilit]
- Engle, R. F., & Granger, C. W. J. (1987). Co-integration and error correction: Representation, estimation, and testing. Econometrica, 55(2), 251–276. [Google Scholar] [CrossRef] [Scilit]
- Erb, C. B., & Harvey, C. R. (2013). The golden dilemma. Financial Analysts Journal, 69(4), 10–42. [Google Scholar] [CrossRef] [Scilit]
- Foroutan, P., & Lahmiri, S. (2024). Deep learning systems for forecasting the prices of crude oil and precious metals. Financial Innovation, 10(1), 111. [Google Scholar] [CrossRef] [Scilit]
- Ghule, S., & Gadhave, V. (2022). Gold price prediction using machine learning. International Journal of Scientific Research in Engineering and Management, 6(6), 1–8. [Google Scholar] [CrossRef] [Scilit]
- Gneiting, T., & Katzfuss, M. (2014). Probabilistic forecasting. Annual Review of Statistics and Its Application, 1, 125–151. [Google Scholar] [CrossRef] [Scilit]
- Granger, C. W. J. (1969). Investigating causal relations by econometric models and cross-spectral methods. Econometrica, 37(3), 424–438. [Google Scholar] [CrossRef] [Scilit]
- Gu, S., Kelly, B., & Xiu, D. (2020). Empirical asset pricing via machine learning. The Review of Financial Studies, 33(5), 2223–2273. [Google Scholar] [CrossRef] [Scilit]
- Hamilton, J. D. (1994). Time series analysis. Princeton University Press. Available online: https://press.princeton.edu/books/hardcover/9780691042893/time-series-analysis (accessed on 13 January 2026).
- Hansen, P. R., Lunde, A., & Nason, J. M. (2011). The model confidence set. Econometrica, 79(2), 453–497. [Google Scholar] [CrossRef] [Scilit]
- Harvey, D., Leybourne, S., & Newbold, P. (1998). Tests for forecast encompassing. Journal of Business and Economic Statistics, 16(2), 254–259. [Google Scholar] [CrossRef] [Scilit]
- Hastie, T., Tibshirani, R., & Friedman, J. (2009). The elements of statistical learning: Data mining, inference, and prediction (2nd ed.). Springer. [Google Scholar] [CrossRef]
- Jimenez Falcón, J. B. (2025). Análisis comparativo de algoritmos de aprendizaje automático para la predicción del precio de los minerales en la Bolsa de Valores de Nueva York, 2024 [Bachelor’s thesis, Universidad José Carlos Mariátegui]. Repositorio Institucional UJCM. Available online: https://repositorio.ujcm.edu.pe/handle/20.500.12819/3461 (accessed on 13 January 2026).
- Johansen, S. (1991). Estimation and hypothesis testing of cointegration vectors in Gaussian vector autoregressive models. Econometrica, 59(6), 1551–1580. [Google Scholar] [CrossRef] [Scilit]
- Kelly, B., Pruitt, S., & Su, Y. (2019). Characteristics are covariances: A unified model of risk and return. Journal of Financial Economics, 134(3), 501–524. [Google Scholar] [CrossRef] [Scilit]
- Khani, M., Vahidnia, S., & Abbasi, A. (2021). A deep learning-based method for forecasting gold price with respect to pandemics. SN Computer Science, 2, 393. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Liang, Y., Lin, Y., & Lu, Q. (2022). Forecasting gold price using a novel hybrid model with ICEEMDAN and LSTM-CNN-CBAM. Expert Systems with Applications, 206, 117847. [Google Scholar] [CrossRef] [Scilit]
- Makridakis, S., Spiliotis, E., & Assimakopoulos, V. (2020). The M4 competition: 100,000 time series and 61 forecasting methods. International Journal of Forecasting, 36(1), 54–74. [Google Scholar] [CrossRef] [Scilit]
- Makridakis, S., Spiliotis, E., & Assimakopoulos, V. (2022). M5 accuracy competition: Results, findings, and conclusions. International Journal of Forecasting, 38(4), 1346–1364. [Google Scholar] [CrossRef] [Scilit]
- Medeiros, M. C., Vasconcelos, G. F. R., Veiga, Á., & Zilberman, E. (2021). Forecasting inflation in a data-rich environment: The benefits of machine learning methods. Journal of Business and Economic Statistics, 39(1), 98–119. [Google Scholar] [CrossRef] [Scilit]
- O’Connor, F. A., Lucey, B. M., Batten, J. A., & Baur, D. G. (2015). The financial economics of gold: A survey. International Review of Financial Analysis, 41, 186–205. [Google Scholar] [CrossRef] [Scilit]
- Ramirez Martínez, C. K. (2017). Determinantes económicas-financieras del precio del oro de 1987 a 2016: Una propuesta usando redes neuronales [Master’s thesis, Universidad Nacional Autónoma de México]. Repositorio Institucional UNAM. Available online: https://repositorio.unam.mx/contenidos/3507368 (accessed on 14 January 2026).
- Rapach, D. E., Strauss, J. K., & Zhou, G. (2010). Out-of-sample equity premium prediction: Combination forecasts and links to the real economy. The Review of Financial Studies, 23(2), 821–862. [Google Scholar] [CrossRef] [Scilit]
- Rumbo Minero. (2024). Producción nacional de oro de enero a octubre del 2024. Available online: https://www.rumbominero.com/peru/noticias/mineria/produccion-nacional-de-oro/ (accessed on 14 January 2026).
- Sadorsky, P. (2021). Predicting gold and silver price direction using tree-based classifiers. Journal of Risk and Financial Management, 14(5), 198. [Google Scholar] [CrossRef] [Scilit]
- Salazar Herrada, E. (2024). Exportaciones de oro peruano se disparan 32% al primer semestre por cotización récord de US$2.205 la onza. Infobae. Available online: https://www.infobae.com/peru/2024/09/11/rally-imparable-del-oro-peruano-exportaciones-se-disparan-32-al-primer-semestre-por-cotizacion-record-de-us2205-la-onza/ (accessed on 14 January 2026).
- Sandoval, L. (2019). Machine learning algorithms for analysis and data prediction. In Proceedings of the IEEE 37th Central America and Panama Convention (CONCAPAN XXXIX), Managua, Nicaragua, November 15–17. IEEE. [Google Scholar] [CrossRef] [Scilit]
- Stock, J. H., & Watson, M. W. (2002). Macroeconomic forecasting using diffusion indexes. Journal of Business and Economic Statistics, 20(2), 147–162. [Google Scholar] [CrossRef] [Scilit]
- Tebin, W., & James, A. (2022, June 15). Gold price prediction using machine learning. National Conference on Emerging Computer Applications (NCECA) (Vol. 4), Kanjirappally, India. [Google Scholar] [CrossRef]
- Tsay, R. S. (2010). Analysis of financial time series (3rd ed.). Wiley. [Google Scholar] [CrossRef] [Scilit]
- Varian, H. R. (2014). Big data: New tricks for econometrics. Journal of Economic Perspectives, 28(2), 3–28. [Google Scholar] [CrossRef] [Scilit]
- Villada, F., Muñoz, N., & García-Quintero, E. (2016). Redes neuronales artificiales aplicadas a la predicción del precio del oro. Información Tecnológica, 27(5), 143–150. [Google Scholar] [CrossRef] [Scilit]
- Wagh, A., Shetty, S., Soman, A., & Maste, D. (2022). Gold price prediction system. International Journal for Research in Applied Science & Engineering Technology, 10(4), 2843–2848. [Google Scholar] [CrossRef] [Scilit]
- West, K. D. (1996). Asymptotic inference about predictive ability. Econometrica, 64(5), 1067–1084. [Google Scholar] [CrossRef] [Scilit]
- Zhang, G., Patuwo, B. E., & Hu, M. Y. (1998). Forecasting with artificial neural networks: The state of the art. International Journal of Forecasting, 14(1), 35–62. [Google Scholar] [CrossRef] [Scilit]
























| Variable | Min. p-Value (Lags 1–3) | Granger-Causes Gold? | Role |
|---|---|---|---|
| S&P 500 | 0.0218 | Yes | REDUCED/CONTROL |
| 10-Year US Treasury Yield (US10Y) | 0.0278 | Yes | REDUCED/CONTROL |
| Copper | 0.0846 | No | REDUCED (theoretical) |
| VIX | 0.0676 | No | FULL only |
| M2 (new) | 0.0602 | No | FULL only |
| WTI Crude Oil | 0.1479 | No | REDUCED (theoretical) |
| CPI (new) | 0.1504 | No | FULL only |
| EUR/USD | 0.2481 | No | FULL only |
| Federal Funds Rate (new) | 0.2133 | No | FULL only |
| USD/CNY | 0.3095 | No | FULL only |
| DXY | 0.3531 | No | FULL only |
| TIP | 0.4156 | No | FULL only |
| Platinum | 0.5271 | No | REDUCED (theoretical) |
| Natural Gas | 0.5362 | No | REDUCED (theoretical) |
| Silver | 0.5636 | No | REDUCED (theoretical) |
| GPR (new) | 0.5639 | No | FULL only |
| GDX (reference) | 0.8160 | No | Excluded as primary predictor |
| Variable | VIF | Assessment |
|---|---|---|
| Platinum | 2.97 | OK |
| Silver | 2.95 | OK |
| WTI Crude Oil | 1.79 | OK |
| 10-Year US Treasury Yield | 1.74 | OK |
| Copper | 1.69 | OK |
| S&P 500 | 1.38 | OK |
| Natural Gas | 1.06 | OK |
| Variable | Skewness | Excess Kurtosis | Jarque–Bera p-Value |
|---|---|---|---|
| S&P 500 | −2.31 | 9.61 | <0.001 |
| 10-Year US Treasury Yield | −1.69 | 8.26 | <0.001 |
| WTI Crude Oil | −0.68 | 7.54 | <0.001 |
| Silver | 0.92 | 2.67 | <0.001 |
| Copper | −1.06 | 2.36 | <0.001 |
| Natural Gas | −0.74 | 1.20 | 0.003 |
| Platinum | 0.17 | 1.73 | 0.006 |
| GDX (control) | 0.08 | −0.51 | 0.627 |
| Set | Model | CV MAPE | Test MAPE (Official, n = 6) | Test MAPE (Sensitivity, n = 10) |
|---|---|---|---|---|
| REDUCED | LR | 1.87% | 3.66% | 3.22% |
| REDUCED | Ridge | 2.30% | 3.82% | 3.24% |
| REDUCED | RF | 2.01% | 3.77% | 3.40% |
| REDUCED | SVR | 2.05% | 4.48% | 3.86% |
| CONTROL | LR | 1.85% | 3.66% | 3.24% |
| CONTROL | Ridge * | 2.29% | 3.62% | 3.15% |
| CONTROL | RF | 2.02% | 3.62% | 3.47% |
| CONTROL | SVR | 2.09% | 4.37% | 4.05% |
| FULL (reference) | LR | 1.81% | 1.86% | 1.96% |
| FULL (reference) | BayesianRidge | 1.44% | 1.94% | 1.94% |
| FACTOR (reference) | BayesianRidge | 2.04% | 3.09% | 2.86% |
| REDUCED/CONTROL (reference) | ElasticNet | 2.79% | 5.04% | 4.47% |
| Model | MAE (USD/oz) | RMSE (USD/oz) | Test MAPE |
|---|---|---|---|
| CONTROL/Ridge (production) | 173.71 | 182.68 | 3.62% |
| Random walk | 224.26 | 250.69 | 4.68% |
| Historical mean | 240.85 | 247.73 | 5.04% |
| Simple exponential smoothing | 470.86 | 491.89 | 9.77% |
| Test | Comparison | Statistic | p-Value |
|---|---|---|---|
| Clark–West | REDUCED vs. CONTROL | 1.76 | 0.039 |
| Clark–West | REDUCED vs. FULL | 2.01 | 0.022 |
| Diebold–Mariano | Production vs. Random Walk | −0.96 | 0.337 |
| Diebold–Mariano | Production vs. Historical Mean | −1.30 | 0.194 |
| Diebold–Mariano | Production vs. Exp. Smoothing | −3.59 | <0.001 |
| Forecast Encompassing | Production vs. Random Walk | −0.46 | 0.677 |
| Forecast Encompassing | Production vs. Historical Mean | −0.47 | 0.670 |
| Forecast Encompassing | Production vs. Exp. Smoothing | 1.23 | 0.306 |
| Model Confidence Set (α = 0.25) | Included: Random Walk, Ridge | — | — |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Velez Flores, A.V.; Chayña Rodriguez, A.R.; Jara Vilca, W.J.; Hancco Ramos, C.P.; Marín Paucara, E.; Quea-Gutierrez, L.; Chayña-Contreras, J.C.; Apaza-Chino, J.; Cuentas Alvarado, M.S.; Llanque Añacata, Y.F.; et al. Predictive Model Based on Machine Learning to Determine Gold Price Fluctuation and Improve Trading Decisions. J. Risk Financ. Manag. 2026, 19, 533. https://doi.org/10.3390/jrfm19070533
Velez Flores AV, Chayña Rodriguez AR, Jara Vilca WJ, Hancco Ramos CP, Marín Paucara E, Quea-Gutierrez L, Chayña-Contreras JC, Apaza-Chino J, Cuentas Alvarado MS, Llanque Añacata YF, et al. Predictive Model Based on Machine Learning to Determine Gold Price Fluctuation and Improve Trading Decisions. Journal of Risk and Financial Management. 2026; 19(7):533. https://doi.org/10.3390/jrfm19070533
Chicago/Turabian StyleVelez Flores, Alexander Vladimir, Arturo Rafael Chayña Rodriguez, Wildor Jazmany Jara Vilca, Carlos Paul Hancco Ramos, Esteban Marín Paucara, Lucio Quea-Gutierrez, Juan Carlos Chayña-Contreras, Julian Apaza-Chino, Mario Serafín Cuentas Alvarado, Yesenia Fátima Llanque Añacata, and et al. 2026. "Predictive Model Based on Machine Learning to Determine Gold Price Fluctuation and Improve Trading Decisions" Journal of Risk and Financial Management 19, no. 7: 533. https://doi.org/10.3390/jrfm19070533
APA StyleVelez Flores, A. V., Chayña Rodriguez, A. R., Jara Vilca, W. J., Hancco Ramos, C. P., Marín Paucara, E., Quea-Gutierrez, L., Chayña-Contreras, J. C., Apaza-Chino, J., Cuentas Alvarado, M. S., Llanque Añacata, Y. F., & Sucari León, A. (2026). Predictive Model Based on Machine Learning to Determine Gold Price Fluctuation and Improve Trading Decisions. Journal of Risk and Financial Management, 19(7), 533. https://doi.org/10.3390/jrfm19070533

