The Double-Layer Clustering Based on K-Line Pattern Recognition Based on Similarity Matching
<p>K-line legend showing (<b>a</b>) an increase with red or white K-line, (<b>b</b>) a decrease with green or black K-line, and (<b>c</b>) market stability with a Doji K-line [<a href="#B30-information-15-00821" class="html-bibr">30</a>].</p> "> Figure 2
<p>Ineffective candlestick pattern rate for different numbers of clusters.</p> ">
Abstract
:1. Introduction
2. Review of the Literature
2.1. The Origin of Candlestick Charts and Their Application in Market Analysis
2.2. Supervised Classification
2.3. Unsupervised Classification
2.4. Machine Learning Models
3. Material and Method
3.1. Data Acquisition
3.2. K-Line Sequence Similarity Matching
3.2.1. Candlestick Pattern Similarity
3.2.2. K-Line Position Similarity
3.2.3. K-Line Sequence Similarity
3.3. Double-Layer Clustering of K-Line Sequences
3.3.1. First-Layer Clustering
3.3.2. Second-Layer Clustering
3.4. Pattern Library Creation
3.5. Pattern Profitability Analysis
4. Results and Discussion
4.1. Cluster Analysis
4.2. Patterns Validation
4.3. Analysis of Pattern Profitability
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Fama, E.F.; French, K.R. The Cross-Section of Expected Stock Returns. J. Financ. 1992, 47, 427–465. [Google Scholar]
- Lintner, J. The Valuation of Risk Assets and the Selection of Risky Investments in Stock Portfolios and Capital Budgets. In Stochastic Optimization Models in Finance; Elsevier: Amsterdam, The Netherlands, 1975; pp. 131–155. [Google Scholar]
- Sharpe, W.F. Capital Asset Prices: A Theory of Market Equilibrium under Conditions of Risk. J. Financ. 1964, 19, 425–442. [Google Scholar]
- Mossin, J. Equilibrium in a Capital Asset Market. Econom. J. Econom. Soc. 1966, 768–783. [Google Scholar] [CrossRef]
- Marshall, B.R.; Cahan, R.H.; Cahan, J.M. Does Intraday Technical Analysis in the US Equity Market Have Value? J. Empir. Financ. 2008, 15, 199–210. [Google Scholar] [CrossRef]
- Jönsson, M.; Jönsson, M. The Predictive Power of Candlestick Patterns. Math. Financ. 2016, 5, 181–205. [Google Scholar]
- Stasiak, M.D. Candlestick—The Main Mistake of Economy Research in High Frequency Markets. Int. J. Financ. Stud. 2020, 8, 59. [Google Scholar] [CrossRef]
- Cagliero, L.; Fior, J.; Garza, P. Shortlisting Machine Learning-Based Stock Trading Recommendations Using Candlestick Pattern Recognition. Expert Syst. Appl. 2023, 216, 119493. [Google Scholar] [CrossRef]
- Lu, T.-H.; Shiu, Y.-M.; Liu, T.-C. Profitable Candlestick Trading Strategies—The Evidence from a New Perspective. Rev. Financ. Econ. 2012, 21, 63–68. [Google Scholar] [CrossRef]
- Lu, T.-H.; Chen, Y.-C.; Hsu, Y.-C. Trend Definition or Holding Strategy: What Determines the Profitability of Candlestick Charting? J. Bank. Financ. 2015, 61, 172–183. [Google Scholar] [CrossRef]
- Heinz, A.; Jamaloodeen, M.; Saxena, A.; Pollacia, L. Bullish and Bearish Engulfing Japanese Candlestick Patterns: A Statistical Analysis on the S&P 500 Index. Q. Rev. Econ. Financ. 2021, 79, 221–244. [Google Scholar] [CrossRef]
- Cohen, G. Optimizing Candlesticks Patterns for Bitcoin’s Trading Systems. Rev. Quant. Financ. Account. 2021, 57, 1155–1167. [Google Scholar] [CrossRef]
- Chen, S.; Bao, S.; Zhou, Y. The Predictive Power of Japanese Candlestick Charting in Chinese Stock Market. Phys. Stat. Mech. Its Appl. 2016, 457, 148–165. [Google Scholar] [CrossRef]
- Murphy, J. Technical Analysis on the Financial Markets; New York Institute of Finance: New York, NY, USA, 1999. [Google Scholar]
- Jasemi, M.; Kimiagari, A.M.; Memariani, A. A Modern Neural Network Model to Do Stock Market Timing on the Basis of the Ancient Investment Technique of Japanese Candlestick. Expert Syst. Appl. 2011, 38, 3884–3890. [Google Scholar] [CrossRef]
- Marszałek, A.; Burczyński, T. Modeling and Forecasting Financial Time Series with Ordered Fuzzy Candlesticks. Inf. Sci. 2014, 273, 144–155. [Google Scholar] [CrossRef]
- Ahmadi, E.; Jasemi, M.; Monplaisir, L.; Nabavi, M.A.; Mahmoodi, A.; Jam, P.A. New Efficient Hybrid Candlestick Technical Analysis Model for Stock Market Timing on the Basis of the Support Vector Machine and Heuristic Algorithms of Imperialist Competition and Genetic. Expert Syst. Appl. 2018, 94, 21–31. [Google Scholar] [CrossRef]
- Mahmoodi, A.; Hashemi, L.; Jasemi, M.; Laliberté, J.; Millar, R.C.; Noshadi, H. A Novel Approach for Candlestick Technical Analysis Using a Combination of the Support Vector Machine and Particle Swarm Optimization. Asian J. Econ. Bank. 2023, 7, 2–24. [Google Scholar] [CrossRef]
- Bustos, O.; Pomares-Quimbaya, A. Stock Market Movement Forecast: A Systematic Review. Expert Syst. Appl. 2020, 156, 113464. [Google Scholar] [CrossRef]
- Goodfellow, I.; Bengio, Y.; Courville, A. Deep Learning; MIT Press: Cambridge, MA, USA, 2016. [Google Scholar]
- Lu, T.-H.; Chen, J. Candlestick Charting in European Stock Markets. JASSA J. Secur. Inst. Aust. 2013, 2, 20–25. [Google Scholar]
- Etschberger, S.; Fock, H.; Klein, C.; Zwergel, B. The Classification of Candlestick Charts: Laying the Foundation for Further Empirical Research; Spiliopoulou, M., Kruse, R., Borgelt, C., Nürnberger, A., Gaul, W., Eds.; Springer: Berlin/Heidelberg, Germany, 2006; pp. 526–533. [Google Scholar]
- Leon Lee, C.-H.; Liu, A. Applying Fuzzy Candlestick Pattern Ontology to Investment Knowledge Management. J. Internet Technol. 2008, 9, 307–315. [Google Scholar]
- Roy, P.; Kumar, D.; Sharma, D. Fuzzy Candlestick Based Stock Market Trading System Using Hammer Pattern. Am. Int. J. Res. Sci. Technol. Eng. Math. 2014, 1, 6–10. [Google Scholar]
- Vásquez, M.L.; González Osorio, F.A.; Hernández Losada, D.F. Mining Candlesticks Patterns on Stock Series: A Fuzzy Logic Approach; Huang, R., Yang, Q., Pei, J., Gama, J., Meng, X., Li, X., Eds.; Springer: Berlin/Heidelberg, Germany, 2009; pp. 661–670. [Google Scholar]
- Chen, W.; Lee, C.; Liu, A. Pattern Discovery of Fuzzy Time Series for Financial Prediction. IEEE Trans. Knowl. Amp Data Eng. 2006, 18, 613–625. [Google Scholar] [CrossRef]
- Arévalo, R.; García, J.; Guijarro, F.; Peris, A. A Dynamic Trading Rule Based on Filtered Flag Pattern Recognition for Stock Market Price Forecasting. Expert Syst. Appl. 2017, 81, 177–192. [Google Scholar] [CrossRef]
- Cervelló-Royo, R.; Guijarro, F.; Michniuk, K. Stock Market Trading Rule Based on Pattern Recognition and Technical Analysis: Forecasting the DJIA Index with Intraday Data. Expert Syst. Appl. 2015, 42, 5963–5975. [Google Scholar] [CrossRef]
- Martiny, K. Unsupervised Discovery of Significant Candlestick Patterns for Forecasting Security Price Movements. In Proceedings of the International Conference on Knowledge Discovery and Information Retrieval, Barcelona, Spain, 4–7 October 2012. [Google Scholar]
- Tao, L.; Hao, Y.T.; Hao, Y.J.; Shen, C.F. K-Line Patterns’ Predictive Power Analysis Using the Methods of Similarity Match and Clustering. Math. Probl. Eng. 2017, 2017, 3096917. [Google Scholar] [CrossRef]
- Quan, Z.Y. Stock Prediction by Searching Similar Candlestick Charts. In Proceedings of the 2013 IEEE 29th International Conference on Data Engineering Workshops (ICDEW), Brisbane, QLD, Australia, 8 April 2013; pp. 322–325. [Google Scholar]
- Zhu, B.; Niu, F. Investor Sentiment, Accounting Information and Stock Price: Evidence from China. Pac.-Basin Financ. J. 2016, 38, 125–134. [Google Scholar] [CrossRef]
- Nison, S. Japanese Candlestick Charting Techniques: A Contemporary Guide to the Ancient Investment Techniques of the Far East; Penguin: London, UK, 2001; ISBN 0-7352-0181-1. [Google Scholar]
Stock Code | Stock Name | Industry | Market Size/USD |
---|---|---|---|
sh601012 | Longi Green Energy | Photovoltaic Equipment | 20.85 billion |
sh600519 | Kweichow Moutai | Liquor Industry | 271.64 billion |
sh601127 | Seres | Automotive | 29.87 billion |
sh601888 | China Duty Free Group | Tourism and Hotels | 21.02 billion |
sh600630 | Longtou Shares | Textiles and Apparel | 0.62 billion |
sh600036 | China Merchants Bank | Banking | 130.64 billion |
sh600571 | Xinyada | Internet Services | 0.92 billion |
sh601318 | Ping An Insurance | Insurance | 142.6 billion |
sh600900 | China Yangtze Power | Electric Power Industry | 91.81 billion |
sh603178 | Shenglong Shares | Automotive Parts | 0.73 billion |
sh600809 | Shanxi Fenjiu | Liquor Industry | 37.26 billion |
Pattern ID | First-Layer Cluster Count (Effective Pattern Label) | Occurrence Count | ||
---|---|---|---|---|
0 | 32–28 | 103 | 0.39 | 0.61 |
1 | 32–29 | 55 | 0.36 | 0.60 |
2 | 37–13 | 67 | 0.36 | 0.63 |
3 | 40–5 | 78 | 0.37 | 0.62 |
4 | 41–39 | 57 | 0.37 | 0.61 |
5 | 43–2 | 84 | 0.61 | 0.37 |
… | … | … | … | … |
828 | 144–11 | 35 | 0.34 | 0.63 |
829 | 144–65 | 33 | 0.33 | 0.67 |
830 | 144–107 | 31 | 0.65 | 0.35 |
831 | 144–113 | 30 | 0.27 | 0.73 |
Pattern ID | First-Layer Cluster Count (Effective Pattern Label) | Occurrence Count | Price | ||
---|---|---|---|---|---|
0 | 49–35 | 76 | 0.36 | 0.63 | … |
1 | 52–46 | 41 | 0.63 | 0.37 | … |
2 | 53–44 | 55 | 0.33 | 0.67 | … |
3 | 55–5 | 47 | 0.62 | 0.36 | … |
4 | 56–34 | 44 | 0.32 | 0.68 | … |
5 | 56–44 | 62 | 0.36 | 0.63 | … |
… | … | … | … | … | … |
152 | 141–71 | 33 | 0.64 | 0.33 | … |
153 | 142–122 | 31 | 0.68 | 0.32 | … |
154 | 144–11 | 33 | 0.33 | 0.67 | … |
155 | 144–113 | 31 | 0.65 | 0.35 | … |
1 | 2 | 3 | 4 | |
---|---|---|---|---|
Bullish pattern | ||||
Bearish pattern |
Pattern Name | Pattern Label | Occurrence Count | ||
---|---|---|---|---|
Bullish pattern 1 | 106–56 | 31 | 0.65 | 0.35 |
Bullish pattern 2 | 92–32 | 35 | 0.69 | 0.31 |
Bullish pattern 3 | 115–9 | 35 | 0.77 | 0.23 |
Bullish pattern 4 | 107–66 | 31 | 0.65 | 0.35 |
Bearish pattern 1 | 82–58 | 31 | 0.29 | 0.71 |
Bearish pattern 2 | 102–41 | 34 | 0.29 | 0.71 |
Bearish pattern 3 | 78–3 | 32 | 0.28 | 0.69 |
Bearish pattern 4 | 109–90 | 33 | 0.33 | 0.64 |
Pattern Name | Occurrence Count | Number of Next-Day Increases/Number of Occurrences | Number of Next-Day Decreases/Number of Occurrences |
---|---|---|---|
Bullish pattern 1 | 13 | 0.92 | 0.08 |
Bullish pattern 2 | 17 | 0.65 | 0.35 |
Bullish pattern 3 | 14 | 0.57 | 0.43 |
Bullish pattern 4 | 8 | 0.625 | 0.375 |
Bearish pattern 1 | 18 | 0.39 | 0.61 |
Bearish pattern 2 | 13 | 0.23 | 0.77 |
Bearish pattern 3 | 10 | 0.30 | 0.70 |
Bearish pattern 4 | 11 | 0.36 | 0.64 |
f | Bullish Pattern 1 | Bullish Pattern 2 | Bullish Pattern 3 | Bullish Pattern 4 | Bearish Pattern 1 | Bearish Pattern 2 | Bearish Pattern 3 | Bearish Pattern 4 |
---|---|---|---|---|---|---|---|---|
1 | 1.0% | 1.3% | 1.2% | 1.8% | −1.3% | −2.1% | −1.9% | −1.5% |
2 | 1.6% | 1.1% | 1.7% | 1.6% | −1.2% | −1.8% | −1.7% | −1.6% |
3 | 1.9% | 0.9% | 1.6% | 1.7% | −1.5% | −1.8% | −1.6% | −1.3% |
4 | 3.8% | 1.4% | 1.4% | 2.4% | −1.9% | −1.7% | −1.3% | −1.2% |
5 | 5.1% | 1.1% | 1.0% | 4.3% | −1.2% | −2.2% | −1.5% | −1.8% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Li, X.; Liu, Q.; Hu, Y.; Liu, H. The Double-Layer Clustering Based on K-Line Pattern Recognition Based on Similarity Matching. Information 2024, 15, 821. https://doi.org/10.3390/info15120821
Li X, Liu Q, Hu Y, Liu H. The Double-Layer Clustering Based on K-Line Pattern Recognition Based on Similarity Matching. Information. 2024; 15(12):821. https://doi.org/10.3390/info15120821
Chicago/Turabian StyleLi, Xinglong, Qingyang Liu, Yanrong Hu, and Hongjiu Liu. 2024. "The Double-Layer Clustering Based on K-Line Pattern Recognition Based on Similarity Matching" Information 15, no. 12: 821. https://doi.org/10.3390/info15120821
APA StyleLi, X., Liu, Q., Hu, Y., & Liu, H. (2024). The Double-Layer Clustering Based on K-Line Pattern Recognition Based on Similarity Matching. Information, 15(12), 821. https://doi.org/10.3390/info15120821