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.
Feng et al. (2026) studied this question.