A Stock Pattern Recognition Algorithm Based On Neural Networks
A Stock Pattern Recognition Algorithm Based On Neural Networks
A Stock Pattern Recognition Algorithm Based On Neural Networks
(a) (b)
Figure 2. The closing price of YanJing Beer Figure 3. The segmentation results. (a) The
on a daily basis from July 25th, 2002 to segmentation result when k = 5 with 111
rd
November 23 , 2005. segments in total; (b) The segmentation
Because stock price time series contains a large result when k = 26 with 19 segments in total.
number of time points, it is a time-consuming job to A technical pattern is composed of several
analyze the patterns from the time series directly. continuous trend segments, based on which several
Therefore, a simplified but efficient method should be samples can be extracted by a certain length of time
used to represent the time series. In this paper, we window. For example, suppose a time series with the
adopt the segmentation process to simplify it, as [2] length T is divided into m trend segments, therefore the
and [9] do. segment series can be denoted as (s1, s2, …, sm), with
There are three methods to realize the trend s i (1 ≤ i ≤ m) representing the ith segment. When
segmentation, including sliding windows, top-down the length of the time window is w, we can extract
and bottom-up [10]. Suppose the stock price time series m-w+1 samples from this sequence of segments,
contains T time points, with the average length for
denoted as (s1, s2, …, sw), (s2, s3, …, sw+1),…,(sm-w+1,
segments as k (1 < k < T), thus the running time for
sm-w+2, …, sm).
both the sliding windows and the bottom-up algorithm
As shown in Figure 4, assuming that the length of
is O (T), while the top-down is O (T2). In this work, we
the time window is 7, we mark the end points of the
choose the bottom-top approach to conduct the time
segments sequentially as 0, 1, 2, …, 7, and make these
series segmentation, with the specific steps as follows.
7 segments into a sample with 8 corresponding price
1) Put the data at both the (2i – 1)th and the 2ith
value denoted as y0, y1, y2, … , y8. Generally, the
time points into one segment, thus the original time
movement range of the price varies according to the
series is divided into T/2 segments.
stock. In order to eliminate the influences caused by
2) Calculate the cost of merging two adjacent
this variance, it is necessary to normalize the price into
segments together, namely the merging cost. Here we
a uniform interval ([0, 1] for instance) [8], or to acquire
define the segment cost as the sum of all the squared
References
[1] N. Bulkowski. Encyclopedia of Chart Patterns, 2nd
Edition. John Wiley and Sons, 2005.
[2] C. L. Osler, and P. H. K. Chang. Head and Shoulders: Not
Just a Flaky Pattern. Staff Report No.4, Federal Reserve Bank
of New York.
[3]W. Leigh, N. Paz, and R. Purvis. Market timing: a test of a
charting heuristic. Economics Letters, 77(1)(2002), 55-63.
[4] W. Leigh, N. Modani, and R. Hightower. A
Computational Implementation of Stock Charting: Abrupt
Volume Increase As Signal for Movement in New York Stock
Exchange Composite Index. Decision Support Systems,
37(4)(2004), 515-530.
[5] A. Lo, H. Mamaysky, and J. Wang. Foundations of
Technical Analysis: Computational Algorithms, Statistical
Inference, and Empirical Implementation. Journal of Finance,
55(4)(2000), 1705-1765.
[6] S. C. Suh , D. Li, and J. Gao. A Novel Chart Pattern