Gold is a widely used investment instrument due to its characteristics as a store of value and a hedge. However, gold prices are volatile, necessitating a forecasting approach that can help predict future price movement trends. This study aims to compare the performance of the XGBoost and Random Forest algorithms in forecasting Antam gold prices using technical indicators. The data used is historical Antam gold price data for the 2020–2025 period with 2,048 observations. Predictor features are formed through a feature engineering process based on historical price data, including close, lag price, Exponential Moving Average (EMA), Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD), and daily return. The prediction target used is the Antam gold price one day ahead or T+1. Model evaluation is carried out using the Walk Forward Validation scheme so that the testing process maintains the time sequence in the time series data. Model performance is measured using Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), and Mean Absolute Percentage Error (MAPE). The results showed that Random Forest achieved the best performance with an RMSE of 21,503.71, an MAE of 15,020.22, and a MAPE of 0.780%. Meanwhile, XGBoost obtained an RMSE of 23,896.92, an MAE of 16,940.59, and a MAPE of 0.878%. These results indicate that Random Forest is superior to XGBoost in forecasting Antam gold prices in this research scenario. Feature importance analysis shows that the close feature, EMA 21, and EMA 9 are the most influential features on the prediction results.
Copyrights © 2026