A Comparative Study of LSTM and BiLSTM Performance in Predicting XAU/USD Prices


  • I Ketut Agung Enriko * Mail Telkom University, Bandung, Indonesia
  • Fikri Nizar Gustiyana Telkom University, Bandung, Indonesia
  • (*) Corresponding Author
Keywords: XAU/USD; LSTM; BiLSTM; Value Forecasting; Time Series

Abstract

Gold price forecasting in the XAU/USD market is challenging due to nonlinear dynamics, high volatility, and sensitivity to global macroeconomic factors. This study compares the performance of Long Short-Term Memory (LSTM) and Bidirectional Long Short-Term Memory (BiLSTM) architectures in forecasting XAU/USD closing prices using historical data from 2023–2026. Data preprocessing includes cleaning, chronological ordering, normalization, and transformation using a sliding window approach. A window size of 60 time steps is selected to represent approximately three months of daily trading activity, enabling the models to capture short- to medium-term temporal dependencies while limiting excessive noise and computational burden. The dataset is divided chronologically into training and out-of-sample testing sets to ensure proper generalization assessment. Both models employ identical architectures with two recurrent layers (50 hidden units each) and are trained using the Adam optimizer with epoch variations (20–100). Evaluation on unseen test data uses MAE, MSE, RMSE, MAPE, and R² metrics. LSTM achieves its lowest MAE of 21.26 at 40 epochs, while BiLSTM attains its best performance at 80 epochs with an MAE of 20.86 and R² of 0.9981. However, extending training to 100 epochs leads to performance degradation in BiLSTM, indicating sensitivity to overtraining. Overall, optimal performance is achieved through balanced training duration rather than increased architectural complexity.

Downloads

Download data is not yet available.

References

M. R. S, M. L. Siraj, A. Caezar, and T. Tadampali, “Understanding Financial Risk Dynamics : Systematic Literature Review inquiry into Credit , Market , and Operational Risks,” J. Ilm. Akunt., vol. 7, no. 2, pp. 1186–1213, 2024, doi: https://doi.org/10.57178/atestasi.v7i2.927.

J. T. Pakpaharan, “Analysis in Decision Making for XAUUSD ( Gold / USD ) Pair Transactions in Futures Trading,” J. Indones. Soc. Sci., vol. 5, no. 10, pp. 2587–2595, 2024, doi: https://doi.org/10.59141/jiss.v5i10.1235.

H. Mangiring and P. Simarmata, “Gold as a Safe Haven During the 2025 Global Tax War : A Qualitative Literature Review,” J. Semesta Ilmu Manaj. dan Ekon., vol. 1, no. 4, 2025, doi: https://doi.org/10.71417/j-sime.v1i4.352.

O. Chuang, R. Gupta, C. Pierdzioch, and B. Shu, “Financial Uncertainty and Gold Market Volatility : Evidence from a Generalized Autoregressive Conditional Heteroskedasticity Variant of the Mixed-Data Sampling ( GARCH-MIDAS ) Approach with Variable Selection,” Econmetrics, vol. 12, no. 38, pp. 1–17, 2024, doi: https://doi.org/10.3390/econometrics12040038.

I. A. F. Putri and Zawawi, “Pengaruh Penggunaan Analisis Fundamental Terhadap Pengambilan Posisi Transaksi Dalam Trading Emas,” J. EKBIS ( Ekon. Bisnis ) Politek. Piksi Ganesha, vol. 12, no. 2, pp. 228–234, 2024, doi: https://doi.org/10.56689/ekbis.v12i2.1496.

M. Isnin, T. Informatika, and U. G. Putih, “Predicted Increase in Gold Price Every Year with Impact on Economic Factors,” Int. J. Econ. Manag. Sci., vol. 1, no. 4, pp. 366–375, 2024, doi: https://doi.org/10.61132/ijems.v1i4.359.

H. Xiong and W. Zhang, “How the US Macroeconomic Factors Affect the Gold Price ?,” in Proceedings of the 8th International Conference on Economic Management and Green Development, 2024, pp. 32–37. doi: 10.54254/2754-1169/124/2024.MUR17825.

E. Golafshani, A. A. Chiniforush, P. Zandifaez, and T. Ngo, “An artificial intelligence framework for predicting operational energy consumption in office buildings,” Energy Build., vol. 317, no. January, p. 114409, 2024, doi: http://doi.org/10.1016/j.enbuild.2024.114409.

H. Handoko, A. Asrofiq, J. Junadhi, and A. S. Negara, “Sentiment Analysis of Sirekap Tweets Using CNN Algorithm,” INTENSIF J. Ilm. Penelit. dan Penerapan Teknol. Sist. Inf., vol. 8, no. 2, pp. 312–329, 2024, doi: https://doi.org/10.29407/intensif.v8i2.23046.

M. Nabipour, P. Nayyeri, H. Jabani, A. Mosavi, E. Salwana, and S. Shahab, “Deep Learning for Stock Market Prediction,” Entropy, vol. 22, no. 840, pp. 1–23, 2020, doi: https://doi.org/10.3390/e22080840.

S. J. Pipin, R. Purba, and H. Kurniawan, “Prediksi Saham Menggunakan Recurrent Neural Network (RNN-LSTM) dengan Optimasi Adaptive Moment Estimation,” J. Comput. Syst. Informatics, vol. 4, no. 4, pp. 806–815, 2023, doi: 10.47065/josyc.v4i4.4014.

I. K. A. Enriko, F. N. Gustiyana, and R. H. Putra, “Komparasi Hasil Optimasi Pada Prediksi Harga Saham PT . Telkom Indonesia Menggunakan Algoritma Long Short Term Memory,” J. Media Inform. Budidarma, vol. 7, no. April, pp. 659–667, 2023, doi: 10.30865/mib.v7i2.5822.

I. K. A. Enriko, F. N. Gustiyana, and H. Krishna, “Forecasting JPFA Share Price using Long Short Term Memory Neural Network,” Jaict, vol. 8, no. 1, p. 157, 2023, doi: 10.32497/jaict.v8i1.4285.

K. Kwanda, D. E. Herwindiati, and M. D. Lauro, “Perbandingan LSTM dan Bidirectional LSTM pada Sistem Prediksi Harga Saham Berbasis Website,” J. Multidiscipliinary Res. Dev., vol. 7, no. 1, pp. 26–35, 2024, doi: https://doi.org/10.38035/rrj.v7i1.

D. I. Puteri et al., “Prediksi Harga Saham Syariah menggunakan Bidirectional Long Short Term Memory ( BiLSTM ) dan Algoritma Grid Search,” Jambura, vol. 6, no. 1, pp. 39–45, 2024, doi: https://doi.org/10.37905/jjom.v6i1.23297.

A. Khumaidi, R. Raafi’udin, and I. P. Solihin, “Pengujian Algoritma Long Short Term Memory untuk Prediksi Kualitas Udara dan Suhu Kota Bandung,” J. Telemat., vol. 15, no. 1, pp. 13–18, 2020, doi: https://doi.org/10.61769/telematika.v15i1.340.

A. A. Ningrum, I. Syarif, A. I. Gunawan, E. Satriyanto, and R. Muchtar, “Algoritma Deep Learning-LSTM untuk Memprediksi Umur Transformator,” J. Teknol. Inf. dan Ilmu Komput., vol. 8, no. 3, p. 539, 2021, doi: 10.25126/jtiik.2021834587.

G. Budiprasetyo, M. Hani, and D. Zahira, “Prediksi Harga Saham Syariah Menggunakan Algoritma Long Short-Term Memory ( LSTM ),” J. Nas. Teknol. dan Sist. Inf., vol. 08, no. 3, pp. 164–172, 2022, doi: https://doi.org/10.25077/TEKNOSI.v8i3.2022.164-172.

Mushliha, “Implementasi CNN-BiLSTM untuk Prediksi Harga Saham Bank Syariah di Indonesia,” Jambura, vol. 6, no. 2, pp. 195–203, 2024, doi: ht- tps://doi.org/10.37905/jjom.v6i2.26509 ©.

D. J. Andriansyach, Sarwido, and H. Mulyo, “Short-Term Cryptocurrency Price Prediction Using Bi-LSTM Method with Interactive Web,” J. Teknol. Dan Sist. Inf. Bisnis, vol. 6, no. 4, pp. 845–850, 2024, doi: https://doi.org/10.47233/jteksis.v6i4.1645 Abstract.


Bila bermanfaat silahkan share artikel ini

Berikan Komentar Anda terhadap artikel A Comparative Study of LSTM and BiLSTM Performance in Predicting XAU/USD Prices

Dimensions Badge
Article History
Submitted: 2026-02-16
Published: 2026-03-06
Abstract View: 154 times
PDF Download: 94 times
How to Cite
Enriko, I. K., & Gustiyana, F. (2026). A Comparative Study of LSTM and BiLSTM Performance in Predicting XAU/USD Prices. Building of Informatics, Technology and Science (BITS), 7(4), 2405−2415. https://doi.org/10.47065/bits.v7i4.9414
Issue
Section
Articles