Attention-Augmented GRU for Stock Forecasting: A Trade-Off Between Directional Accuracy and Price Prediction Error
DOI:
https://doi.org/10.62411/jcta.15863Keywords:
Attention mechanism, Deep Learning, Directional accuracy, Efficient market hypothesis, Financial time series, Gated recurrent unit, Stock forecasting, Sustainable economic systemsAbstract
Attention mechanisms have been widely incorporated into recurrent neural network architectures for financial time series forecasting, with most prior work reporting improvements in price-level error metrics. This study revisits that claim through a controlled empirical comparison of four deep learning architectures on nearly two decades of Telkom Indonesia (TLKM) closing price data from the Indonesia Stock Exchange (IDX). The models evaluated are a three-layer Gated Recurrent Unit (GRU) baseline, a comparable Long Short-Term Memory (LSTM) network, a Bahdanau end-attention GRU (Attn-GRU-V2), and a multi-head self-attention GRU hybrid (Attn-GRU-V3). Each architecture is trained over 30 independent runs with distinct random seeds, and performance is reported as 95% confidence intervals derived from the t-distribution. Statistical comparisons employ the Wilcoxon signed-rank test, a nonparametric paired test appropriate given the confirmed non-normality of residuals. The main finding is a consistent trade-off: the plain GRU achieves the lowest RMSE (94.02 ± 1.22 IDR) across all 30 runs, while Attn-GRU-V2 achieves the highest directional accuracy (45.91 ± 0.09%), surpassing GRU in every independent run. Bahdanau attention weights are nearly uniform across the 30-day lookback window (coefficient of variation: 3.21%), indicating that the mechanism cannot identify selectively informative timesteps in this univariate price series. This finding is consistent with the weak-form Efficient Market Hypothesis for the Indonesian market. An ablation study reveals that a 20-day lookback window maximizes directional accuracy (47.72 ± 0.21%) for the Attn-GRU-V2 model. These results suggest that Bahdanau end-attention consistently and significantly improves directional accuracy relative to a plain GRU baseline, providing an architecturally attributable advantage for direction-based applications, even when absolute price-level error is not reduced. The directional accuracy values remaining below 50% across all models are consistent with a weak-form efficiency characterization of the Indonesian market.References
R. Butet and S. A. Kesuma, “Efficient Market Hypothesis: A Systematic Literature Review,” RIGGS J. Artif. Intell. Digit. Bus., vol. 4, no. 4, pp. 2127–2132, Nov. 2025, doi: 10.31004/riggs.v4i4.3549.
A. T. Haryono, R. Sarno, and K. R. Sungkono, “Stock price forecasting in Indonesia stock exchange using deep learning: a comparative study,” Int. J. Electr. Comput. Eng., vol. 14, no. 1, p. 861, Feb. 2024, doi: 10.11591/ijece.v14i1.pp861-869.
F. Furizal, A. B. Fawait, H. Maghfiroh, A. Ma’arif, A. A. Firdaus, and I. Suwarno, “Long Short-Term Memory vs Gated Recurrent Unit: A Literature Review on the Performance of Deep Learning Methods in Temperature Time Series Forecasting,” Int. J. Robot. Control Syst., vol. 4, no. 3, pp. 1506–1526, Sep. 2024, doi: 10.31763/ijrcs.v4i3.1546.
S. Hochreiter and J. Schmidhuber, “Long Short-Term Memory,” Neural Comput., vol. 9, no. 8, pp. 1735–1780, Nov. 1997, doi: 10.1162/neco.1997.9.8.1735.
G. Sonkavde, D. S. Dharrao, A. M. Bongale, S. T. Deokate, D. Doreswamy, and S. K. Bhat, “Forecasting Stock Market Prices Using Machine Learning and Deep Learning Models: A Systematic Review, Performance Analysis and Discussion of Implications,” Int. J. Financ. Stud., vol. 11, no. 3, p. 94, Jul. 2023, doi: 10.3390/ijfs11030094.
M. Louisa, G. Darmawan, and B. Tantular, “Enhancing Stock Price Forecasting with CNN-BiGRU-Attention: A Case Study on INDY,” Mathematics, vol. 13, no. 13, p. 2148, Jun. 2025, doi: 10.3390/math13132148.
S. Azman, D. Pathmanathan, and V. Balakrishnan, “A two-stage forecasting model using random forest subset-based feature selection and BiGRU with attention mechanism: Application to stock indices,” PLoS One, vol. 20, no. 5, p. e0323015, May 2025, doi: 10.1371/journal.pone.0323015.
B. H. C. and I. Jeena Jacob, “A Hybrid CNN-LSTM Attention-Based Deep Learning Model for Stock Price Prediction Using Technical Indicators,” Eng. Technol. Appl. Sci. Res., vol. 15, no. 5, pp. 28012–28017, Oct. 2025, doi: 10.48084/etasr.12685.
Y. Li, S. Lv, X. Liu, and Q. Zhang, “Incorporating Transformers and Attention Networks for Stock Movement Prediction,” Complexity, vol. 2022, no. 1, Jan. 2022, doi: 10.1155/2022/7739087.
S. Joddy, “Comparative Analysis of CNN, LSTM, and CNN–LSTM for Indonesian Stock Prediction,” Eng. Math. Comput. Sci. J., vol. 7, no. 3, pp. 283–289, Sep. 2025, doi: 10.21512/emacsjournal.v7i3.14326.
S. Agusta, F. Rakhman, J. H. Mustakini, and S. Wijayana, “Enhancing the accuracy of stock return movement prediction in Indonesia through recent fundamental value incorporation in multilayer perceptron,” Asian J. Account. Res., vol. 9, no. 4, pp. 358–377, Aug. 2024, doi: 10.1108/AJAR-01-2024-0006.
K. Cho et al., “Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation,” in Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2014, pp. 1724–1734. doi: 10.3115/v1/D14-1179.
A. Lawi, H. Mesra, and S. Amir, “Implementation of Long Short-Term Memory and Gated Recurrent Units on grouped time-series data to predict stock prices accurately,” J. Big Data, vol. 9, no. 1, p. 89, Dec. 2022, doi: 10.1186/s40537-022-00597-0.
C. Chen, L. Xue, and W. Xing, “Research on Improved GRU-Based Stock Price Prediction Method,” Appl. Sci., vol. 13, no. 15, p. 8813, Jul. 2023, doi: 10.3390/app13158813.
D. Bahdanau, K. Cho, and Y. Bengio, “Neural Machine Translation by Jointly Learning to Align and Translate,” in arXiv, May 2016, pp. 1–15. [Online]. Available: http://arxiv.org/abs/1409.0473
M.-C. Lee, “Research on the Feasibility of Applying GRU and Attention Mechanism Combined with Technical Indicators in Stock Trading Strategies,” Appl. Sci., vol. 12, no. 3, p. 1007, Jan. 2022, doi: 10.3390/app12031007.
J. Zhang, L. Ye, and Y. Lai, “Stock Price Prediction Using CNN-BiLSTM-Attention Model,” Mathematics, vol. 11, no. 9, p. 1985, Apr. 2023, doi: 10.3390/math11091985.
Y. Liu, X. Liu, Y. Zhang, and S. Li, “CEGH: A Hybrid Model Using CEEMD, Entropy, GRU, and History Attention for Intraday Stock Market Forecasting,” Entropy, vol. 25, no. 1, p. 71, Dec. 2022, doi: 10.3390/e25010071.
A. Vaswani et al., “Attention Is All You Need,” arXiv, vol. 30, Aug. 2023, [Online]. Available: http://arxiv.org/abs/1706.03762
A. Tiwari, C.-S. Shieh, M. P. Kantipudi, and S. Shilpa, “Hybrid CNN–LSTM Integrated with Temporal Fusion Transformer for Accurate and Interpretable Stock Market Forecasting,” Ingénierie des systèmes d Inf., vol. 30, no. 11, pp. 3045–3054, Nov. 2025, doi: 10.18280/isi.301122.
P. O. Odion, M. M. Lawal, and A. Abdulrauf, “A Comparative Analysis of an Enhanced Hybrid Model for Predicting Dollar Against Naira Exchange Rate Using Deep Learning and Statistical Methods,” J. Comput. Theor. Appl., vol. 2, no. 4, pp. 511–522, Apr. 2025, doi: 10.62411/jcta.12513.
N. Y. Vanguri, S. Pazhanirajan, and T. A. Kumar, “Competitive feedback particle swarm optimization enabled deep recurrent neural network with technical indicators for forecasting stock trends,” Int. J. Intell. Robot. Appl., vol. 7, no. 2, pp. 385–405, Jun. 2023, doi: 10.1007/s41315-022-00250-2.
T. T. Thach, “Forecasting Stock Market Indices Using Integration of Encoder, Decoder, and Attention Mechanism,” Entropy, vol. 27, no. 1, p. 82, Jan. 2025, doi: 10.3390/e27010082.
O. Bustos, A. Pomares-Quimbaya, and R. Stellian, “Machine learning, stock market forecasting, and market efficiency: a comparative study,” Int. J. Data Sci. Anal., vol. 20, no. 7, pp. 6815–6839, Nov. 2025, doi: 10.1007/s41060-025-00854-4.
W. Budiharto, “Data science approach to stock prices forecasting in Indonesia during Covid-19 using Long Short-Term Memory (LSTM),” J. Big Data, vol. 8, no. 1, p. 47, Dec. 2021, doi: 10.1186/s40537-021-00430-0.
B. Sartono, T. S. Elenaputri, Y. Angraini, and G. A. Dito, “Long Short‐Term Memory‐Based Prediction of Indonesian Composite Stock Index Returns for Early Identification of Market Crises,” Appl. Comput. Intell. Soft Comput., vol. 2025, no. 1, Jan. 2025, doi: 10.1155/acis/6174081.
B. Y. Dwiandiyanta, R. Hartanto, and R. Ferdiana, “Harnessing Deep Learning and Technical Indicators for Enhanced Stock Predictions of Blue-Chip Stocks on the Indonesia Stock Exchange (IDX),” Eng. Technol. Appl. Sci. Res., vol. 15, no. 1, pp. 20348–20357, Feb. 2025, doi: 10.48084/etasr.9850.
M. N. Aisy, S. A. Wulandari, and D. R. I. M. Setiadi, “A Probabilistic Feature-Augmented GRU-Attention Model for Chronic Disease Prediction on Imbalanced Data,” J. Futur. Artif. Intell. Technol., vol. 2, no. 2, pp. 282–293, Jul. 2025, doi: 10.62411/faith.3048-3719-100.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 R. Daniel Hartanto, Guruh Fajar Shidik, Farrikh Alzami, Ahmad Zainul Fanani, Aris Marjuni, Abdul Syukur

This work is licensed under a Creative Commons Attribution 4.0 International License.













