[Paper Review] Encoding Candlesticks as Images for Patterns Classification Using Convolutional Neural Networks
This paper proposes GAF-CNN, a novel method that encodes financial time series data from candlestick charts into Gramian Angular Fields (GAF) for image-based classification using Convolutional Neural Networks (CNNs). The approach achieves 90.7% average accuracy in identifying eight key candlestick patterns on real-world EUR/USD forex data, outperforming LSTM models and demonstrating strong performance even with subtle pattern distinctions.
Candlestick charts display the high, low, opening, and closing prices in a specific period. Candlestick patterns emerge because human actions and reactions are patterned and continuously replicate. These patterns capture information on the candles. According to Thomas Bulkowski's Encyclopedia of Candlestick Charts, there are 103 candlestick patterns. Traders use these patterns to determine when to enter and exit. Candlestick pattern classification approaches take the hard work out of visually identifying these patterns. To highlight its capabilities, we propose a two-steps approach to recognize candlestick patterns automatically. The first step uses the Gramian Angular Field (GAF) to encode the time series as different types of images. The second step uses the Convolutional Neural Network (CNN) with the GAF images to learn eight critical kinds of candlestick patterns. In this paper, we call the approach GAF-CNN. In the experiments, our method can identify the eight types of candlestick patterns with 90.7% average accuracy automatically in real-world data, outperforming the LSTM model.
Motivation & Objective
- To automate the recognition of candlestick patterns in financial time series, reducing reliance on manual trader judgment.
- To improve classification accuracy of key candlestick patterns by transforming time series data into image representations suitable for CNNs.
- To evaluate the effectiveness of the GAF-CNN framework on both simulated and real-world financial data.
- To compare the performance of GAF-CNN against existing models like LSTM in detecting subtle candlestick patterns.
- To demonstrate the feasibility and robustness of using image-based deep learning for technical analysis in finance.
Proposed method
- The method uses the Gramian Angular Field (GAF) to convert one-dimensional OHLC or CULR time series data into two-dimensional image-like matrices that preserve temporal dependencies.
- The GAF transformation encodes time series data by mapping values into polar coordinates and computing pairwise angular differences, resulting in a symmetric matrix representation.
- The resulting GAF images are fed into a two-convolutional-layer CNN with 16 kernels per layer and a 128-neuron fully connected layer for classification.
- The model is trained end-to-end using backpropagation, leveraging the CNN’s ability to learn spatial hierarchies of features from the GAF-encoded images.
- Two feature sets are evaluated: OHLC (opening, high, low, closing) and CULR (closing, upper shadow, lower shadow, real body), with CULR showing superior performance.
- The framework is validated on both synthetic data generated via Geometric Brownian Motion and real-world EUR/USD per-minute data from 2010 to 2018.
Experimental results
Research questions
- RQ1Can GAF-encoded time series data be effectively used as input for CNNs to classify candlestick patterns with high accuracy?
- RQ2How does the GAF-CNN model compare in performance to LSTM models for candlestick pattern recognition?
- RQ3Does the choice of feature representation (OHLC vs. CULR) significantly affect classification accuracy?
- RQ4How robust is the GAF-CNN model in handling real-world financial data with noisy and dynamic patterns?
- RQ5To what extent can the model distinguish between visually similar candlestick patterns with subtle differences?
Key findings
- The GAF-CNN model achieved an average classification accuracy of 90.7% on real-world EUR/USD per-minute data, outperforming the LSTM baseline.
- The CULR feature set (closing, upper shadow, lower shadow, real body) yielded higher accuracy (92.42%) than the OHLC set in simulation data.
- Class 0 (likely a reversal or rare pattern) showed higher false positive rates, indicating a more conservative classification behavior.
- Despite minor misclassifications, the model maintained high recall for the main pattern types, supporting practical usability.
- The model successfully extracted subtle visual features from GAF-encoded images, enabling discrimination of similar candlestick patterns.
- The open-source implementation of Series2GAF is available for transforming time series into GAF images, enhancing reproducibility and extensibility.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.