# An Application of the Associate Hopfield Network for Pattern Matching in Chart Analysis
## 1 Introduction  
Chart analysis is a kind of technical analysis in financial trading, which is different from quantitative analysis. The quantitative analysis intends to predict an exact future price by using machine learning models or deep learning models. Chart analysis aims to predict the trend of the future price according to the price pattern of the historical data. The traders and the financial analyst believe the theory that some specific patterns that have appeared before would appear again. Accordingly, these patterns could be signals for trading decisions. For example, the Head-and-Shoulder (H&S) pattern is believed to be one of the most reliable trend-reversal patterns. This pattern consists of three peaks, the first and third peaks are the shoulders and they represent the small rallies of the stock price. The second peak forms the head and it is the sign that the price would subsequently decline. A neckline can be drawn connecting the bottom of the two shoulders and the pattern can be confirmed normally when the closing price is clearly below this line. Lots of works have been proposed to analyze the relationship of the movement of the financial market and the shape of the chart pattern. [PERSON] [1] studies the character of the chart patterns and summarizes 53 applicable trading patterns. [PERSON] et al. [2] divided the patterns into five categories in terms of their shape on the basis of [PERSON]'s work. In this paper, we adopt several classic patterns to generate synthetic data. How to find the subsequences that match the query patterns as much as possible [3] has become an important problem in technical analysis. This question can be explained as given a fixed length of the financial time series data, find all the subsequences similar to the stored or expected pattern like H&S. Normally, pattern matching approaches in financial chart analysis can be categorized as template-based, rule-based, training based and distance-based. Most of them need to be segmented as a data preprocessing process and then the similarity between the processed data and the predefined template needs tobe evaluated. Once the similarity reaches or exceeds a given threshold by the analyst, the subsequence can be accepted as a specific tradable pattern. The existing time series data mining research has been studied thoroughly in [4; 5; 6]. [PERSON] et al. proposed a preprocessing method called perceptually important point (PIP) [3; 7] to reduce the fluctuant data points and extract a given number of points to represent the subsequence of the time series data. [PERSON] et al. proposed piecewise aggregate (PAA) method [8] and piecewise linear approximation (PLA) method [9]. The PAA approach divides the time series data into \(N\) equal parts and calculates the mean value of each part to represent the subsequence. The PLA method adopts the sliding window to scan the subsequence in a top-down or bottom-up way to extract several straight lines to segment the data. In addition, [PERSON] et al. [10] proposed a segmentation method based on TPs (turning points). [PERSON] et al. conducted several experiments [5] of different segmentation methods on the synthetic data and concluded that the PIP segmentation is robust in different similarity measurement and can preserve the overall shape of the subsequence. Other than the segmentation methods mentioned above, [PERSON] and [PERSON] et al. utilized a grid template method [11; 12] to represent the 'Bull Flag' pattern. [PERSON] et al. proposed a grid template representation for pattern recognition in the forex market [13]. They introduced the template grid to capture the chart formation and defined a novel similarity measurement based on the template grid. The similarity measurement is also critical to the matching result. In the work of [PERSON] et al., they introduced a temporal distance (TD) [3] measurement to define the similarity of the segmented sequence and the predefined template.