Analyzing Candlesticks Quantitatively
Coding Candlesticks (II)
G
TECHNIQUES
Analyzing Candlesticks Quantitatively Coding Candlesticks (II)
by Viktor Likhovidov Jan
My idea of assigning a numeric
value to a single candlestick is based on the principle that the relationship
between opening and closing prices is the most important for interpretation
of the candle. So in construction of the quantitative characteristic of a
candle, I took these prices into account as the main factor. My method uses
a candle's binary code (see sidebar, "How to code a candlestick"), so characteristics
of opening and closing prices should be reflected in the highest bites?
BYTES? DEFINE of this code. This gives them the greatest weight. The parameters
of the candle's shadows are placed in lower bites of the code, giving them
lower weight. Thus, the numeric representation of the code is the weight of
the candle. This automatically assigns the highest influence on the candle's
weight to the body. A candle's binary code also has the sense of a candle's
weight because binary representation is additive: a candle's weight is equal
to the sum of its body's weight, plus its upper shadow's and lower shadow's
weights.
A
candle's color is the main factor in evaluation of its sense from the point
of possible market movement. A white candle (close > open) shows bullish market
movement, so with all other circumstances being equal, it more clearly expresses
bullish market sentiment than does a black candle (close < open). Considering
candles individually, without taking into account the context created by nearby
candles, any white candle is more bullish than any black one, independent of
their sizes and shadow configurations. My method is designed for description
of isolated candles, so I place "1" in the highest bite for a white candle and
"0" for a black candle. Now, any white candle has a higher value than any black
candle, since a white candle's code cannot be less than 1000000 = 26 = 64, while
a black candle's code cannot be greater than 0111111 = 25 + 24 + 23 + 22 + 21
+ 20 = 32 + 16 + 8 + 4 + 2 + 1 = 63. Coding and weighing groups of candles is
another problem and it demands another approach, although aggregating individual
candles' codes into an indicator is a start.
The
next most important factor is the size of a candle's body: the greater the difference
between opening and closing prices, the clearer the market's sentiment. What
is "large" and "small" for candle-body size depends on the market's volatility
statistics and on the intent of your coding procedure. You can introduce as
many categories as you want: extremely small, very small, small, typical, middle,
and as many categories, if not more, to the upper side. Such a scheme could
be constructed if necessary, but the simplest approach is best. Therefore, I
introduced only three categories: small, middle, and large. A fourth category,
null, seems important to me, since a doji-type candle - which has zero body
size and is white if its upper shadow is longer than its lower shadow - demonstrates
the market's indecision. It is also mathematically convenient to represent the
four body sizes with two portions. If anybody wants to consider as doji not
only null-body candles (open = close) but also candles with very small sizes
(such as 5-10 pips DEFINE), then it may be done by slight modification of the
classification rules. In particular, the body of a long white candle gets 111
(value 112) because it is the most bullish of all white candles, and 000 (value
zero) is assigned to the body of a long black candle, the most bearish of all
black candles. The greater the body's size in a white candle, the higher the
code it is assigned, and vice versa; for black candles, the lowest codes are
assigned to the largest bodies. The code of a doji corresponds to the range
in the middle of the weights; the doji's body has code 100 (value 64) or 001
(value 16) assigned, depending on whether white or black is assigned to it.
A
candle with a long upper shadow is more bullish than a similar candle with a
small upper shadow. A candle with a long lower shadow is more bearish than a
candle with a small lower shadow. Consider two candles (Figure 1). Both have
a medium-sized body and small upper shadows, but candle A's lower shadow is
large, while candle B has none. The code of candle A and its digital representation
- weight - is 1100100 = 64+32+4 = 100, and for candle B is 1100111 = 64+32+4+2+1
= 103. If the same candles are black, the undoubtedly bearish sense of the black
candle A becomes even more expressed in comparison with the black B. For the
black variant of candle A, we have 0010100 = 16+4 = 20 and for the black variant
of B, 0010111 = 16+4+2+1 = 23. Further, there is no need for juggling in this
coding. All that is required is to apply mathematical notation to what is known
and used by every chartist. Some shortcomings of my approach are evident. For
example, the upper and lower shadows obtain very different weights: the maximum
contribution of an upper shadow into the candle's weight is 12, but for the
lower shadow it is only 3. I have used another variant of the candle index,
one that I call CandleWeight (see Traders' Tips elsewhere in this issue), with
a positive value for the body's weight for a white candle and a negative body's
weight for a black candle. Upper shadows had positive weights and lower shadows
had negative weights, and absolute values of weights for shadows were equal
for equal length of shadows. However, there was a small difference in the behavior
of the indicators; all support and resistance levels, trends, and crossing points
of moving averages almost coincided and gave the same trade signals. Because
of that, I returned to the simpler scheme, which I refer to as CandleCode. For
those who want to assign different coefficients - weights - to the body and
shadows, altering the formula from November 1999, you get this expression: Weight
= B x CandleCode-b + U x CandleCode-u + L x CandleCode-l where B, U, and L are
optimizable coefficients.
Use
some statistical analysis to define small, medium, and large candle bodies.
I usually use histograms of the sizes of bodies and candles for this purpose.
For example, four-week intervals are used for hourly candle charts. (These histograms
show that the distributions of sizes are not log-normal, but exponential.) My
thresholds were initially based on the equal probabilities of clusters of body
sizes. For example, 33% of candles had small bodies and 33% had middle bodies,
while the rest were large. These empirical thresholds were fixed and then used
for code construction; later, new four-week histograms were formed. I have used
this strategy since 1998 for spot currency markets (hourly charts of yen, British
pound, Deutschemark, and Swiss franc), and the sizes generated have demonstrated
a high degree of stability over time. Corresponding thresholds for various currencies
differed by about 10-20% on different time intervals, but such deviations hardly
changed the behavior of averaged indicators. This represents some evidence of
statistical robustness for averaged CandleCode indicators, proving to be a useful
property in financial decisions, and at the same time suggesting the universality
of the scheme.
The
use of the Bollinger Bands for threshold selection seems to be a good and practical
solution. The computation of bands per se does not require any specific properties
of the normal distribution. For exponential distributions, the parameters I
use do not give equally probable clusters of body sizes, but the high statistical
stability of CandleCode indicators does give satisfactory results, so I do not
regard this as disabling. In addition, if a trader wants better-fitting indicators
for a certain market, he may run his own estimation of threshold selection levels
for his own candlestick price charts.
The
quantitative measurement of market sentiment and the attempt to express its
psychology in a series of digits is an immense challenge. The problem does not
have a unique and universal solution, so different approaches should be tried
and objectively estimated. Quantifying candlesticks is only one attempt to do
so. Viktor Likhovidov, a financial analyst and consultant based in Vladivostok,
Russia, performs research in the areas of pattern recognition, neural networks,
and mathematical methods in currency markets analysis. He may be reached at
lita@math.dvgu.ru.
V
- Likhovidov, Viktor [1999]. "Coding Candlesticks" Technical Analysis of STOCKS
& COMMODITIES, Volume 17: November. Morris, Greg L. [1995].
- Candlestick Charting
Explained: Timeless Techniques For Trading Stocks And Futures, Irwin Publishing.
- Nison, Steve [1991]. Japanese Candlestick Charting Techniques,
New York Institute of Finance/Simon & Schuster.[1994].
Back
to top
Published with special permission from Victor Jan Likhovidov