Candlestick Patterns Recognition using CNN-LSTM Model to Predict Financial Trading Position in Stock Market


  • Aditya Ramadhan * Mail Telkom University, Bandung, Indonesia
  • Irma Palupi Telkom University, Bandung, Indonesia
  • Bambang Ari Wahyudi Telkom University, Bandung, Indonesia
  • (*) Corresponding Author
Keywords: Candlestick Patterns; Trading Positions; Long Short-Term Memory; Convolutional Neural Network; Predict

Abstract

Investors need analytical tools to predict the price and to determine trading positions. Candlestick pattern is one of the analytical tools that predict price trends. However, the patterns are difficult to recognize, and some studies show doubts regarding the robustness of the recognizing system. In this study, we tested the predictive ability of candlestick patterns to determine trading positions. We use Gramian Angular Field (GAF) to encode candlestick patterns as images to recognize 3-hour and 5-hour of 6 candlestick patterns with Convolutional Neural Network (CNN), coupled with the Long short-term memory (LSTM) model to predict the close price. The trading position consists of buying and selling position with a hold period of several hours. Our results show CNN successfully detected 3-hour and 5-hour GAF candlestick patterns with an accuracy of 90% and 93%. LSTM can predict the close price trend with 155.458 RMSE scores and 0.9754% MAPE with 10-hour look back. With a hold duration of three hours and CNN-LSTM as an additional model, the test data's 85 candlestick patterns are recognized with 82.7% accuracy, compared to 60% accuracy of profitable trading positions when CNN candlestick pattern recognition is used alone. Compared to employing CNN candlestick pattern identification alone, the CNN-LSTM model combination can improve the prediction power of candlestick patterns and offer more lucrative trading positions.

Downloads

Download data is not yet available.

References

T. Kouzoubasis and H. al Sakka, “The Impact of Short Selling on Stock Returns-An Event Study in Sweden,” 2021.

K. Prachyachuwong and P. Vateekul, “Stock trend prediction using deep learning approach on technical indicator and industrial specific information,” Information (Switzerland), vol. 12, no. 6, Jun. 2021, doi: 10.3390/info12060250.

Y. SANTUR, “Candlestick chart based trading system using ensemble learning for financial assets,” Sigma Journal of Engineering and Natural Sciences – Sigma Mühendislik ve Fen Bilimleri Dergisi, 2022, doi: 10.14744/sigma.2022.00039.

W. Hu, Y. W. Si, S. Fong, and R. Y. K. Lau, “A formal approach to candlestick pattern classification in financial time series,” Applied Soft Computing Journal, vol. 84, Nov. 2019, doi: 10.1016/j.asoc.2019.105700.

Y. Lin, S. Liu, H. Yang, H. Wu, and B. Jiang, “Improving stock trading decisions based on pattern recognition using machine learning technology,” PLoS ONE, vol. 16, no. 8 August, Aug. 2021, doi: 10.1371/journal.pone.0255558.

J.-H. Chen and Y.-C. Tsai, “Encoding Candlesticks as Images for Patterns Classification Using Convolutional Neural Networks,” Jan. 2019, [Online]. Available: http://arxiv.org/abs/1901.05237

Yang, Chao-Lung & Yang, Chen-Yi & Chen, Zhi-Xuan & Lo, and Nai-Wei, “ Multivariate Time Series Data Transformation for Convolutional Neural Network,” pp. 188–192, 2019, doi: doi:10.1109/sii.2019.8700425.

M. Roondiwala, H. Patel, and S. Varma, “Predicting Stock Prices Using LSTM,” Article in International Journal of Science and Research, vol. 6, 2017, doi: 10.21275/ART20172755.

J. H. U, P. Y. Lu, C. S. Kim, U. S. Ryu, and K. S. Pak, “A new LSTM based reversal point prediction method using upward/downward reversal point feature sets,” Chaos, Solitons and Fractals, vol. 132, Mar. 2020, doi: 10.1016/j.chaos.2019.109559.

Stephen W. Bigalow, The Major Candlestick Signals. The Candlestick Forum LLC, 2014.

Z. Wang and T. Oates, “Encoding Time Series as Images for Visual Inspection and Classification Using Tiled Convolutional Neural Networks,” 2015. [Online]. Available: www.aaai.org

Z. Wang and T. Oates, “Imaging Time-Series to Improve Classification and Imputation,” May 2015, [Online]. Available: http://arxiv.org/abs/1506.00327

D. Sabir, M. A. Hanif, A. Hassan, S. Rehman, and M. Shafique, “TiQSA: Workload Minimization in Convolutional Neural Networks Using Tile Quantization and Symmetry Approximation,” IEEE Access, vol. 9, pp. 53647–53668, 2021, doi: 10.1109/ACCESS.2021.3069906.

A. Andriyanto, A. Wibowo, and N. Z. Abidin, “Sectoral stock prediction using convolutional neural networks with candlestick patterns as input images,” International Journal of Emerging Trends in Engineering Research, vol. 8, no. 6, pp. 2249–2252, Jun. 2020, doi: 10.30534/ijeter/2020/07862020.

W. Hilal, S. A. Gadsden, and J. Yawney, “Financial Fraud: A Review of Anomaly Detection Techniques and Recent Advances,” Expert Systems with Applications, vol. 193. Elsevier Ltd, May 01, 2022. doi: 10.1016/j.eswa.2021.116429.

W. Lu, J. Li, Y. Li, A. Sun, and J. Wang, “A CNN-LSTM-based model to forecast stock prices,” Complexity, vol. 2020, 2020, doi: 10.1155/2020/6622927.


Bila bermanfaat silahkan share artikel ini

Berikan Komentar Anda terhadap artikel Candlestick Patterns Recognition using CNN-LSTM Model to Predict Financial Trading Position in Stock Market

Dimensions Badge
Article History
Submitted: 2022-08-18
Published: 2022-09-03
Abstract View: 5959 times
PDF Download: 3263 times
Section
Articles