Application of Decision Tree in Global Gold Price Forecasting

Authors

  • Pratiwi Adityaningrum Statistics
  • Teti Sofia Yanti Fakultas Farmasi dan Sains, Universitas Islam Bandung

Keywords:

Decision Tree Regression, Forecasting, Time Series

Abstract

Abstract. Gold is widely recognized as a safe-haven asset due to its ability to preserve value during periods of economic uncertainty. However, gold prices are highly volatile and influenced by various economic factors, making accurate forecasting a challenging task. This study aims to implement the Decision Tree regression method for forecasting global gold prices, evaluate the model performance using the coefficient of determination (R²) and Mean Absolute Percentage Error (MAPE), and generate a one-step-ahead forecast. The study employed historical daily gold price data from 2 January 2018 to 31 March 2026, consisting of the variables Open, High, Low, Close, and Volume. Data preprocessing included first-order differencing to transform the target variable into price changes between consecutive observations. The Decision Tree model was validated using Rolling Window Cross Validation through the TimeSeriesSplit approach, while hyperparameter optimization was conducted by evaluating combinations of max_depth and min_samples_leaf. Model performance was assessed based on the average values of R² and MAPE across validation folds. The experimental results indicate that the optimal model was achieved with max_depth = 3 and min_samples_leaf = 5, producing an average R² of 0.9683 and MAPE of 0.95%, indicating that the model successfully explained approximately 96.83% of the variation in gold prices while maintaining a very low prediction error. The optimized model was subsequently used to forecast the global gold price for 1 April 2026, resulting in a predicted price of USD 4,691.69. These findings demonstrate that the Decision Tree method can effectively model nonlinear patterns in historical gold price data and provides a reliable alternative for short-term gold price forecasting.

References

D. G. Baur and T. K. McDermott, “Is gold a safe haven? International evidence,” J. Bank. Financ., vol. 34, no. 8, pp. 1886–1898, Aug. 2010, doi: 10.1016/j.jbankfin.2009.12.008.

Y. Bofinger, K. J. Heyden, B. Rock, and C. E. Bannier, “The sustainability trap: Active fund managers between ESG investing and fund overpricing,” Financ. Res. Lett., vol. 45, p. 102160, Mar. 2022, doi: 10.1016/j.frl.2021.102160.

M. Xie, M. Irfan, A. Razzaq, and V. Dagar, “Forest and mineral volatility and economic performance: Evidence from frequency domain causality approach for global data,” Resour. Policy, vol. 76, p. 102685, Jun. 2022, doi: 10.1016/j.resourpol.2022.102685.

T. Hong, P. Wang, and L. White, “Weather station selection for electric load forecasting,” Int. J. Forecast., vol. 31, no. 2, pp. 286–295, Apr. 2015, doi: 10.1016/j.ijforecast.2014.07.001.

S. Makridakis, E. Spiliotis, and V. Assimakopoulos, “Statistical and Machine Learning forecasting methods: Concerns and ways forward,” PLoS One, vol. 13, no. 3, p. e0194889, Mar. 2018, doi: 10.1371/journal.pone.0194889.

P. Sadorsky, “Predicting Gold and Silver Price Direction Using Tree-Based Classifiers,” J. Risk Financ. Manag., vol. 14, no. 5, p. 198, Apr. 2021, doi: 10.3390/jrfm14050198.

L. J. Tashman, “Out-of-sample tests of forecasting accuracy: an analysis and review,” Int. J. Forecast., vol. 16, no. 4, pp. 437–450, Oct. 2000, doi: 10.1016/S0169-2070(00)00065-0.

M. Jiang, J. Liu, L. Zhang, and C. Liu, “An improved Stacking framework for stock index prediction by leveraging tree-based ensemble models and deep learning algorithms,” Phys. A Stat. Mech. its Appl., vol. 541, p. 122272, Mar. 2020, doi: 10.1016/j.physa.2019.122272.

J. F. Torres, D. Hadjout, A. Sebaa, F. Martínez-Álvarez, and A. Troncoso, “Deep Learning for Time Series Forecasting: A Survey,” Big Data, vol. 9, no. 1, pp. 3–21, Feb. 2021, doi: 10.1089/big.2020.0159.

A. Cutler, D. R. Cutler, and J. R. Stevens, “Random Forests,” in Ensemble Machine Learning, New York, NY: Springer New York, 2012, pp. 157–175. doi: 10.1007/978-1-4419-9326-7_5.

T. Hastie, R. Tibshirani, and J. Friedman, The Elements of Statistical Learning. New York, NY: Springer New York, 2009. doi: 10.1007/978-0-387-84858-7.

T. F. Guerin, “Tactical problems with strategic consequences: A case study of how petroleum hydrocarbon suppliers support compliance and reduce risks in the minerals sector,” Resour. Policy, vol. 74, p. 102310, Dec. 2021, doi: 10.1016/j.resourpol.2021.102310.

S. Ben Jabeur, S. Mefteh-Wali, and J.-L. Viviani, “Forecasting gold price with the XGBoost algorithm and SHAP interaction values,” Ann. Oper. Res., vol. 334, no. 1–3, pp. 679–699, Mar. 2024, doi: 10.1007/s10479-021-04187-w.

R. S. Sinambela, M. Ula, and A. F. Ulva, “Prediksi Harga Emas Menggunakan Algoritma Regresi Linear Berganda Dan Support Vector Machine (SVM),” J. Sist. dan Teknol. Inf., vol. 12, no. 2, p. 253, Apr. 2024, doi: 10.26418/justin.v12i2.73386.

H. M. Nawawi, “(Skripsi) Prediksi Harga Emas Di Indonesia Menggunakan Algoritma Gradient Boosting Regressor,” pp. 1–109, 2020, [Online]. Available: https://repository.nusamandiri.ac.id/repo/files/240758/download/14002223_Hendri-Mahmud-Nawawi-(Full-Tesis).pdf

Published

2026-08-02