The Double-Layer Clustering Based on K-Line Pattern Recognition Based on Similarity Matching - Xinglong Li; Qingyang Liu; Yanrong Hu; Hongjiu Liu (Information)
Candlestick charts provide a visual representation of price trends and market sentiment, enabling investors to identify key trends, support, and resistance levels, thus improving the success rate of stock trading. The research presented in this paper aims to overcome the limitations of traditional candlestick pattern analysis, which is constrained by fixed pattern definitions, quantity limitations, and subjectivity in pattern recognition, thus improving its effectiveness in dynamic market environments. To address this, a two-layer clustering method based on a candlestick sequence simlarity matching model is proposed for identifying valid candlestick patterns and constructing a pattern library. First, the candlestick sequence similarity matching model is used to address the pattern matching issue; then, a two-layer clustering method based on the K-means algorithm is designed to identify valid candlestick patterns. Finally, a valid candlestick pattern library is built, and the predictive ability and profitability of some patterns in the library are evaluated. In this study, ten stocks from different industries and of various sizes listed on the Shanghai Stock Exchange were selected, using nearly 1000 days of their data as the test set. The predictive ability of some patterns in the library was evaluated using out-of-sample data from the same period. This selection method ensures the diversity of the dataset. The experimental results show that the proposed method can effectively distinguish between bullish and bearish patterns, breaking through the limitations of traditional candlestick pattern classification methods that rely on predefined patterns. By clearly distinguishing these two patterns, it provides clear buy and sell signals for investors, significantly improving the reliability and profitability of trading strategies.