The idea of using the chart with candlesticks (or candles) for predicting market prices is very old. Two centuries ago, Japanese rice trader found that the candlesticks pattern chart could be used as a tool to predict future prices in a free market with a natural demand-supply balance. The method was improved later by others and today it is successfully used by many traders and investors in the stock market.
A candlestick is presented using high, low, opening, and closing prices during a certain trading period, for example, trading day. A regular candlestick figure consists of Real Body, Upper Shadow, and Lower Shadow. The Real Body size is proportional to the difference between opening and closing prices. Real Body can be two types - white (green) for uptrend and black (red) for downtrend. Upper Shadow size is proportional to the difference between either high price and closing price in case of uptrend or high price and opening price in case of downtrend. Similarly, Lower Shadow size is proportional to the difference between either low price and opening price in case of uptrend or low price and closing price in case of downtrend.
The number of candlesticks that is normally used for predicting can range within 1..12. Evidently, the number of different combinations of several candlesticks in a row can be big. Some believe that there are only 12 major candlestick patterns, others consider this number is 70 or even more. Anyway, in case of chart analysis, it is necessary to remember at least major patterns and process many charts in order to make forecast successful.
Apparently, statistical methods combined with computer power can be a good solution to make the candlestick patterns recognition work less time-consuming and more effective. For example, Neural Network (NN) can help to automate a candlestick patterns recognition task. NN should be properly trained in order to be able to recognize and predict further movements. One of the obvious problems of implementing a candlestick pattern NN predicting system is a formalization of inputs, i.e., the way how to express each candlestick shape and relative position of all candlesticks in numerical values.
Preparing Data for Neural Network. The idea is simple - look at several candlesticks, recognize pattern, and predict the next candlestick. But how to convert a candlestick shape in numerical values? For simplicity, let's consider one major characteristic of each candlestick. In case of using six candlesticks to predict the performance within the next seventh one (actually the value of Real Body can be considered as an equivalent of performance), the data row for training neural network would be presented by the following:
In reality we need to use more input parameters including shadows, relative position of each candlestick, etc. so that it can be, for example, 60 inputs for each row:
The candlesticks pattern can be formalized in different ways. Which one is the best? It may depend on the type of NN that is used and statistical characteristic of input data. Evidently, only practical testing (out-of-sample test) can indicate which formalization can give the best result for most cases. Logically, all numbers that describe candlestick shape should be expressed in relative units. For example, Real Body size can be converted using the following formula:
RB = 100% * (C - O) / O
where RB - Real Body relative size, C - closing price, O - opening price.
Two more numbers can express the Upper an Lower Shadows relatively to Real Body. The following figure shows distances that used for calculation relative Upper and Lower Shadows:
US = 100% * c / a
LS = 100% * c / b
where US, LS - relative Upper and Lower Shadows correspondingly. US and LS can have values within 0..100%; minimum value equals 0 if Real Body size equals 0, and maximum value equals 100 if Shadow size equals 0. Therefore, we can use these three numbers for formalizing one candlestick. The number of candlesticks that can be used for historical period can be up to 12. So that the number of inputs for NN can be equal 3 * 12 = 36.
Two More Inputs for Candlestick Pattern Recognition. As it was discussed above, we can use three major numbers to describe the pattern of one candlestick - relative size of Real Body, relative size of Upper Shadow and Lower Shadow. Also we can use 12 candlesticks with these three parameters for each as inputs. However, it would be insufficient to use only these parameters since each candlestick can have different position and their relative position traditionally is used for the analysis and prediction.
The simplest position parameter would be a percentage deviation from an average of all candlesticks position. It could be just closing prices of each period of candlestick. The formula for calculation:
CPi = 100% * (Ci / Caver - 1)
where CPi - relative position of i-candlestick; Ci - closing price of i-candlestick; Caver - average of all closing prices (all 12 candlesticks).Except above introduced parameter, it could be reasonable to add one more parameter to distinguish negative and positive candlesticks (black and white) since it makes a significant difference to investors' psychology. So that each black candlestick would have 0 value, white - 1. To summarize, 5 parameters multiplied by 12 (the total number of candlesticks) give 60 inputs.
Numerous tests show many possibilities of improving NN candles patterns recognition abilities. For example, output result can be composed from selected optimized calculations based on different historical periods. As well as, there are many other different ways to formalize the shapes and relative positions of candlesticks.
Optimal Solution. There is an automated tool
FTA-2 (free use of fully-functional version for one month). It has module which enables using Neural Network to recognize typical candles patterns and predict future prices. This module predicts only one next candle but the candles pattern prediction can be successfully used for different widths of candle, i.e., the number of trading days in one candle. The module is enhanced to calculate result that is composed from different historical periods that allows making the forecast more accurate. Also it can perform comparative forecast analysis for many symbols.
Useful resources:- Candlestick basics - major signals
- Neural Network basics - introduction
- The software which enables using Neural Network to recognize typical candles patterns and predict future prices - about FTA-2