Research on Stock Price Prediction Based on a Hybrid LSTM-Transformer Model
DOI:
https://doi.org/10.61173/mww03g17Keywords:
Long short-term memory (LSTM), Transformer model, Adjusted Close PriceAbstract
The goal of this paper is to establish a hybrid Long Short-Term Memory (LSTM)-Transformer model to achieve stock price prediction. By comparing the baseline LSTM model to the hybrid model, it is evident that the hybrid model outperforms the baseline in stock price prediction. It is vital for achieving optimal capital allocation, effective risk management, and successful execution. This model is based on next-day log return regression with return to price reconstruction, trained on daily OHLCV (data of stock about OPEN, HIGH, LOW, CLOSE, and VOLUME) features from 2021 to 2023 and evaluated in the first quarter of 2024 (Q1 2024). During the testing period, the mean absolute error (MAE) drops from 10.43 to 1.58, the root mean square error (RMSE) from 12.34 to 2.33, and the Price rises from 0.25 to 0.97. Directional Accuracy improves from 60.66% to 65.57%, and on strong move days, it improves from 59.57% to 65.96%. The above results demonstrate that the hybrid LSTM-Transformer model outperforms the LSTM baseline model in terms of stock price prediction. Residual diagnostics reveal a mean close to zero and heavy tails with occasional spikes, which is consistent with event-driven jumps that cannot be anticipated using end-of-day data alone. These results support the use of the hybrid model for daily equity prediction and point out directions for future improvement, such as adding the process of volatility normalization, considering explicit event or gap features, and adopting tail robust or quantile objectives.
References
[1] Zhou Jingwen. Stock forecasting based on the ARIMA model -- taking the Bank of China as an example [J]. Modern Computer, 2024, 30(14): 89–92.
[2] Wang Chaojie, Chen Yuanyuan, Zhang Shuqi, Zhang Qiuhui. Stock market index prediction using a deep Transformer model. Expert Systems with Applications, 2022, 208, 118128. DOI: 10.1016/j.eswa.2022.118128.
[3] Jaimin Shah, Darsh Vaidya, Manan Shah. A comprehensive review of multiple hybrid deep learning approaches for stock prediction. Intelligent Systems with Applications, 2022, 16, 200111. DOI: 10.1016/j.iswa.2022.200111.
[4] Lounnapha Sayavong, Wu Zhongdong, Sookasame Chalita. Research on a stock price prediction method based on a convolutional neural network. 2019 International Conference on Virtual Reality and Intelligent Systems (ICVRIS), Jishou, China, Sept 14–15, 2019. IEEE, 2019: 173–176. DOI: 10.1109/ ICVRIS.2019.00050.
[5] Shakir Khan and Hela Alghulaiakh. ARIMA Model for Accurate Time Series Stocks Forecasting. International Journal of Advanced Computer Science and Applications (IJACSA), 2020, 11(7). DOI: 10.14569/IJACSA.2020.0110728.
[6] Hum Nath Bhandari, Binod Rimal, Nawa Raj Pokhrel, et al. Predicting the stock market index using LSTM. Machine Learning with Applications, 2022, 9, 100320. DOI: 10.1016/ j.mlwa.2022.100320.
[7] Wu Mingtai, Li Zhongcui, Norbert Herencsar, et al. A graphbased CNN-LSTM stock price prediction algorithm with leading indicators. Multimedia Systems, 2023, 29(3), 1751-1770. DOI: 10.1007/s00530-021-00758-w.
[8] Ma Dongbo. The Research on Stock Price Prediction Method Based on Graph Convolutional Networks. Master‘s thesis, Shandong Technology and Business University, 2024. Available: CNKI database, Accession No. 10.27903/d.cnki. gsdsg.2024.000081.
[9] Dawood Muhammad. NVIDIA stock data [Dataset]. Kaggle, 2023. Available from: https://www.kaggle.com/datasets/ muhammaddawood42/nvidia-stock-data.
[10] Ruan Junhao, Wang Kang, Feng Tianyun, et al. A Transformer-based Stock Forecasting Method [J]. Computer & Digital Engineering, 2025, 53(05),1375-1380.
Downloads
Published
Issue
Section
License
Copyright (c) 2025 by the authors.

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