journal article·2026-02-07Open access

Hierarchical Attention Fused CNN-LSTM Using Structured 2D Indicator Matrices for Stock Trading Action Detection

Hao Feng, Xian Li, Dongjie Zhao, Hui Kong

Applied Sciences· Volume 16· Issue 4

Abstract

Accurate detection of trading actions (buy, sell, and hold) is critical for portfolio optimization and risk management in volatile stock markets. However, existing approaches often suffer from deficiencies in feature representation, spatiotemporal modeling, and class balancing, which limit their effectiveness. To address these issues, we propose HA-CL, a deep learning framework that integrates a hierarchical attention mechanism with CNN-LSTM. Specifically, technical indicators are encoded into a structured 2D matrix to preserve the inherent characteristics of stocks. Features extracted by ResNet are processed by a channel-wise LSTM equipped with an attention core to adaptively fuse spatial, temporal, and channel-level importance. To mitigate class imbalance, we design a customized extrema labeling strategy augmented with extrema oversampling, an importance-aware focal loss, and a heuristic action recalibration. Experiments on 63 Chinese A-share stocks show that HA-CL achieves an average accuracy of 68.89% with an annualized return of 111.01%, substantially outperforming all baselines. Risk-adjusted return metrics such as the Sharpe Ratio and the Maximum Drawdown further validate its robustness across market conditions. Together, they highlight the potential of HA-CL to translate complex market patterns into profitable trading actions.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Stock Market Forecasting Methods · Financial Markets and Investment Strategies · Explainable Artificial Intelligence (XAI)

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

School of Automation, Qingdao University, Qingdao 266071, China

Shandong Key Lab of Industrial Control Technology, Qingdao University, Qingdao 266071, China

References (55)

Show source-provided references
1. A prediction model of stock market trading actions using generative adversarial network and piecewise linear representation approaches10.1007/s00500-022-07716-2 ↗
2. Ye, X., and Li, H. (2011, January 14–15). ARMA-VWAP Strategy and Its Application in Chinese Stock Market. Proceedings of the 2011 International Conference on Social Sciences and Society (ICSSS 2011), Shanghai, China.
3. Wei, W., Li, H., Wang, X., and Li, J. (2007, January 25–27). Time series forecasting by ANN and SVM hierarchical architecture. Proceedings of the 2nd International Conference on Computer Science and Education, Wuhan, China.
4. A parallel multi-module deep reinforcement learning algorithm for stock trading10.1016/j.neucom.2021.04.005 ↗
5. Sang, S., and Li, L. (2024). A Novel Variant of LSTM Stock Prediction Method Incorporating Attention Mechanism. Mathematics, 12.10.3390/math12070945 ↗
6. GCNET: Graph-based prediction of stock price movement using graph convolutional network10.1016/j.engappai.2022.105452 ↗
7. Stock Price Movement Prediction based on Relation Type guided Graph Convolutional Network10.1016/j.engappai.2023.106948 ↗
8. Lee, M.C. (2025). Temporal Fusion Transformer-Based Trading Strategy for Multi-Crypto Assets Using On-Chain and Technical Indicators. Systems, 13.10.3390/systems13060474 ↗
9. A novel trading system for the stock market using Deep Q-Network action and instance selection10.1016/j.eswa.2024.125043 ↗
10. Stock movement prediction via gated recurrent unit network based on reinforcement learning with incorporated attention mechanisms10.1016/j.neucom.2021.09.072 ↗
11. Long Short-Term Memory and Discrete Wavelet Transform based Univariate Stock Market Prediction Model
12. A new financial data forecasting model using genetic algorithm and long short-term memory network10.1016/j.neucom.2020.04.086 ↗
13. Algorithmic financial trading with deep convolutional neural networks: Time series to image conversion approach10.1016/j.asoc.2018.04.024 ↗
14. Forecasting turning points in stock price by applying a novel hybrid CNN-LSTM-ResNet model fed by 2D segmented images10.1016/j.engappai.2022.105464 ↗
15. LeCun, Y., and Bengio, Y. (1998). Convolutional networks for images, speech, and time series. The Handbook of Brain Theory and Neural Networks, ACM, Inc.
16. 3D Convolutional Neural Networks for Human Action Recognition10.1109/TPAMI.2012.59 ↗
17. Fully Convolutional Networks for Semantic Segmentation10.1109/TPAMI.2016.2572683 ↗
18. A Multi-indicator Feature Selection for CNN-Driven Stock Index Prediction
19. Improving Stock Price Forecasting Using a Large Volume of News Headline Text
20. CNN-Trans-SPP: A small Transformer with CNN for stock price prediction10.3934/era.2024314 ↗
21. A learning algorithm for continually training neural networks10.1162/neco.1989.1.2.270 ↗
22. Jordan, M.I. (1986, January 15–17). Attractor dynamics and parallelism in a connectionist sequential machine. Proceedings of the 8th Annual Conference of the Cognitive Science Society, Amherst, MA, USA.
23. Short-Term Memory and Long-Term Memory are Still Different10.1037/bul0000108 ↗
24. Cho, K., Van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., and Bengio, Y. (2014). Learning phrase representations using RNN encoder-decoder for statistical machine translation. arXiv.10.3115/v1/D14-1179 ↗
25. MCI-GRU: Stock prediction model based on multi-head cross-attention and improved GRU10.1016/j.neucom.2025.130168 ↗
26. Cui, Z., Ke, R., Pu, Z., and Wang, Y. (2018). Deep bidirectional and unidirectional LSTM recurrent neural network for network-wide traffic speed prediction. arXiv.
27. Attention-based Conv-LSTM and Bi-LSTM networks for large-scale traffic speed prediction10.1007/s11227-022-04386-7 ↗
28. Elite GA-based feature selection of LSTM for earthquake prediction10.1007/s11227-024-06218-2 ↗
29. Chen, K., Zhou, Y., and Dai, F. (November, January 29). A LSTM-based method for stock returns prediction: A case study of China stock market. Proceedings of the 2015 IEEE International Conference on Big Data, Santa Clara, CA, USA.10.1109/BigData.2015.7364089 ↗
30. Can deep machine learning outsmart the market? A comparison between econometric modelling and long-short term memory
31. Stock price prediction based on LSTM and LightGBM hybrid model10.1007/s11227-022-04326-5 ↗
32. Zhu, M., Qi, H., and Qin, P. (2025). IGWO-MALSTM: An Improved Grey Wolf-Optimized Hybrid LSTM with Multi-Head Attention for Financial Time Series Forecasting. Appl. Sci., 15.10.3390/app15126619 ↗
33. A CNN-LSTM model for gold price time-series forecasting10.1007/s00521-020-04867-x ↗
34. Selvin, S., Vinayakumar, R., Gopalakrishnan, E.A., Menon, V.K., and Soman, K.P. (2017, January 13–16). Stock price prediction using LSTM, RNN and CNN-sliding window model. Proceedings of the 2017 International Conference on Advances in Computing, Communications and Informatics (ICACCI), Manipal, India.10.1109/ICACCI.2017.8126078 ↗
35. Zhang, J., Ye, L., and Lai, Y. (2023). Stock Price Prediction Using CNN-BiLSTM-Attention Model. Mathematics, 11.10.3390/math11091985 ↗
36. Stock price prediction based on MDT-CNN-LSTM model
37. Song, H., and Choi, H. (2023). Forecasting Stock Market Indices Using the Recurrent Neural Network Based Hybrid Models: CNN-LSTM, GRU-CNN, and Ensemble Models. Appl. Sci., 13.10.3390/app13074644 ↗
38. Woo, S., Park, J., Lee, J.Y., and Kweon, I.S. (2018, January 8–14). CBAM: Convolutional Block Attention Module. Proceedings of the 15th European Conference on Computer Vision (ECCV), Munich, Germany.10.1007/978-3-030-01234-2_1 ↗
39. Triaxial modality attention fusion with top-down mask generation for enhanced multimodal sentiment analysis10.1007/s11227-025-07474-6 ↗
40. A CBAM Based Multiscale Transformer Fusion Approach for Remote Sensing Image Change Detection10.1109/JSTARS.2022.3198517 ↗
41. Research on stock forecasting based on LSTM-CNN-CBAM model
42. Ye, P., Zhang, H., and Zhou, X. (2024). CNN-CBAM-LSTM: Enhancing Stock Return Prediction Through Long and Short Information Mining in Stock Prediction. Mathematics, 12.10.3390/math12233738 ↗
43. Research on Chinese stock index prediction based on MVC5B hybrid model
44. Lai, C.Y., Chen, R.C., and Caraka, R.E. (2019, January 7–10). Prediction stock price based on different index factors using LSTM. Proceedings of the 2019 International Conference on Machine Learning and Cybernetics (ICMLC), Kobe, Japan.10.1109/ICMLC48188.2019.8949162 ↗
45. Technical indicators and cross-sectional expected returns10.1016/j.gfj.2022.100781 ↗
46. A CNN-Based Method for AAPL Stock Price Trend Prediction Using Historical Data and Technical Indicators
47. Forecasting price movements using technical indicators: Investigating the impact of varying input window length10.1016/j.neucom.2016.11.095 ↗
48. Semi-Varying Coefficient Panel Data Model with Technical Indicators Predicts Stock Returns in Financial Market10.1007/s11424-024-2331-0 ↗
49. Kouatli, I., and Yunis, M. (2021, January 7–8). A Guide to stock-trading decision Making based on popular Technical Indicators. Proceedings of the 2021 International Conference on Decision Aid Sciences and Application (DASA), Sakheer, Bahrain.10.1109/DASA53625.2021.9682337 ↗
50. Tian, Y., Ma, T., Jiang, Q., Liu, Q., and Khan, M.K. (2023). A Correlational Strategy for the Prediction of High-Dimensional Stock Data by Neural Networks and Technical Indicators. Big Data and Security, Springer.10.1007/978-981-99-3300-6 ↗
51. Multifactor prediction model for stock market analysis based on deep learning techniques10.1038/s41598-025-88734-6 ↗
52. Predicting the Brazilian Stock Market with Sentiment Analysis, Technical Indicators and Stock Prices: A Deep Learning Approach10.1007/s10614-024-10636-y ↗
53. Chittora, V., and Gupta, C.P. (2020, January 3–5). Dynamic spot price forecasting using stacked LSTM networks. Proceedings of the 2020 3rd International Conference on Intelligent Sustainable Systems (ICISS), Thoothukudi, India.10.1109/ICISS49785.2020.9315988 ↗
54. Salimath, S., Chatterjee, T., Mathai, T., Kamble, P., and Kolhekar, M. (2021, January 23–24). Prediction of stock price for indian stock market: A comparative study using LSTM and GRU. Proceedings of the International Conference on Advances in Computing and Data Sciences, Nashik, India.10.1007/978-3-030-88244-0_28 ↗
55. Gangwani, P., and Panthi, V. (2025). Leveraging multimodal data and deep learning for enhanced stock market prediction. AI-Based Advanced Optimization Techniques for Edge Computing, John Wiley & Sons, Inc.10.1002/9781394287062.ch4 ↗