Komparasi LSTM dan GRU untuk Prediksi Harga XAUUSD dan Sinyal Trading
Abstract
The foreign exchange market and the XAUUSD instrument are highly volatile, requiring forecasting
methods that can model temporal dependencies. This study compares Long Short-Term Memory (LSTM)
and Gated Recurrent Unit (GRU) for forecasting XAUUSD closing prices and generating Buy, Sell, and
Hold signals as decision-support outputs for swing trading. Gold Futures data with ticker GC=F were
collected from Yahoo Finance at a daily frequency from 2 January 2020 to 28 April 2026. A total of 1,596
rows were processed using the Close feature, MinMaxScaler normalization, a 60-day sliding window, and a
sequential split of 80% training and 20% testing data. The two architectures were controlled to be
comparable and evaluated using RMSE, MAE, MAPE, and training time. In the reported detailed run,
GRU obtained RMSE 82.2814, MAE 52.9155, and MAPE 1.3290%, whereas LSTM obtained RMSE
102.4626, MAE 65.0265, and MAPE 1.5705%. LSTM trained faster, requiring 91.90 seconds compared
with 156.43 seconds for GRU. With a ±0.5% prediction-change threshold, GRU generated a higher Hold
proportion of 49.7%, indicating more selective entry recommendations. The results indicate that GRU is
superior in detailed-run accuracy, while LSTM is superior in training efficiency.

