Pattern Recognition And Candlesticks

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

B

y now, who hasn't heard of the Japanese form of charting called candlesticks? Until Steve Nison

introduced candlestick charting to the West a few years ago, charting services or software programs that offered graphically displayed data in candlestick format were few and far between. Finding a guidebook or manual on interpretations of candlesticks and their patterns was almost unattainable unless one could read Japanese. Since then, there has been a stampede for chart services to offer traders the ability to chart data in candlestick format. There has also been a groundswell of interest to learn about this form of technical analysis. But the question is obvious. Why has there been so much curiosity about candlesticks? Why are many Western technicians and professional traders incorporating candlesticks into their trading systems? How useful are candlesticks? If candlestick charting and candlestick technical analysis are here in the West to stay and be incorporated into the traditions of Western technical analysis, as many believe, then how will we use them effectively when all the dust settles? How will candlesticks develop into future trading systems? Most important, why should we use candlesticks at all? OF VENERABLE AGE Perhaps the oldest form of technical analysis known to us is candlesticks. But it is not necessarily a complex one. Plotting candlesticks is a simple thing. To create the candle, one simply needs the open, high, low and close. The thick part of the candlestick is known as the real body and represents the range between the open and close. The real body can be filled or empty. When the close is lower than the open the real body is filled in (dark). When the close is higher than the open, the real body is left empty (light). (Traditionally, the Japanese used black and red ink to represent full and empty candles.) The thin lines above and below the real body are known as shadows and represent the high and low for that cycle

Article Text

Copyright (c) Technical Analysis Inc.

1

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

(Figure 1). The names given to the candles in many cases are symbolic, describing the shape of the candle or the relationship between the candle's open, high, low and close. With names such as "hanging man," "belt hold line" and "shooting star," the Japanese have been able to devise a visual image or word picture to identify different candles. The names given to the candlestick patterns are also replete in vivid cultural imagery with descriptive titles such as "dark coloud cover,""three-Buddha tops," and "morning, evening and three river stars."

B

oth candlestick and traditional bar charts are powerful foundations for the technical analysis of price

changes, but candlesticks can transcend the bar chart in that some candles can indicate price change as well. An example of this is the "doji" group of candles, which are formed when the open is equal (or almost equal) to the close. The doji can signal an immediate turning point. It can be bullish or bearish, depending on where it appears in a trend (Figure 2). The "doji star," a small doji that gaps above or below the prior candle's real body, might indicate the cessation of a current market direction. A trader could use this knowledge when looking at other technical indicators such as moving averages, stochastics, support, resistance and trend analysis (Figures 3 and 4). COMPUTER -AIDED RECOGNITION Each basic candle formation has many variations. Advanced candlestick patterns can consist of as many as 30 to 60 single candles. This presents a problem when trying to create a pattern recognition system (PRS) to isolate specific patterns. How do we tell the system what to look for? How do we classify the data variables the PRS uses? To build an intelligent pattern recognition system, we must first assign classes, or groups, of patterns. This process is similar to building a base of knowledge. We will use this base of knowledge to associate and recognize patterns. Next, we need to assign the set of data variables used to isolate, or find, the patterns. Japanese candlesticks use four basic data variables: open, high, low and close. We will need to use other sets of data variables to isolate, or find, different pattern types. The knowledge base is critical in making the PRS properly interpret each individual pattern. By incorrectly assigning a pattern, or group of patterns, the PRS will confuse valid patterns with invalid patterns without consistency. Also, incomplete assignment of a pattern will cause mixed or inconsistent recognition of certain related patterns. For example, assume we were telling the PRS to locate a long white line (Figure 5). If we assigned its formula as: if (CLOSE > OPEN) { LONG_WHITE_LINE } the PRS would associate any candle cycle that had a close greater than its open. But this does not necessarily constitute a long white line. The PRS needs to compare the range of this candle against the

Article Text

Copyright (c) Technical Analysis Inc.

2

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

average range of all the candles to verify that this candle has a greater-than-average range. We add two more data variables. Our formula now looks like this: if (CLOSE > OPEN && CANDLE_RANGE > AVERAGE_CANDLE_RANGE) { LONG_WHITE_LINE }

A

re we done with this pattern assignment? What would the PRS call the examples in Figure 6, given

the fact that their range all exceeded the average candle range? The PRS would interpret all these candles as long white lines because each candle meets the parameters of our assigned pattern, although only one is a long white line. Our PRS didn't know that a long white line needs to have a higher degree of classifications within our assignment, or a more complete assignment. At this point, we must begin to organize the pattern assignment associations in logical order so that the PRS can begin to relate what it knows about the patterns it discovers. This is known as the engine, the basic responsibility of which is to classify all data variables and provide a basic interpretive structure, similar to learning your ABCs and how to count to 100. The engine normally consists of all necessary structural formats and data groups assigned to these formats. We must analyze the structure of each candle and its relation to the other candles so the engine can relate this information back to our knowledge base. The three basic candle types are: 1.) OPEN = CLOSE. Doji 2.) OPEN > CLOSE. Black or Full 3.) OPEN < CLOSE. White or Empty

Using logic variables with your patterns organized from most critical to least critical ensures proper pattern recognition. Based on these three groups of data, we need to define what we know about each. In order to provide a subjective viewpoint for the PRS, however, we should always consider the relation of the candles to each other. Dojis are classically defined as OPEN = CLOSE, but dojis do not always have to have an equal open and close. In such cases, we teach the PRS about them by assigning a different pattern for each. 1) OPEN = CLOSE. Doji A. Doji (OPEN = CLOSE) a. Grave Stone Doji b. Dragon Fly Doji c. Doji Star d. Long Doji

Article Text

Copyright (c) Technical Analysis Inc.

3

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

B. Black Doji (OPEN = CLOSE (+-2%)) a. Black Grave Stone Doji b. Black Dragon Fly Doji c. Black Doji Star d. Long Black Doji C. White Doji (CLOSE = OPEN(+-2%)) a. White Grave Stone Doji b. White Dragon Fly Doji c. White Doji Star d. Long White Doji 2) OPEN > CLOSE. Black or Full A. Long Black Line a. Marubozu b. Opening Bozu c. Closing Bozu d. Long Black Line B. Short Black Line a. Upper Shadow b. Lower Shadow c. Spinning Top d. Small Star C. Black Umbrella Lines a. Hammer b. Hangman c. Inverted Hammer 3) OPEN < CLOSE. White or empty A. Long White Line ... a. Marubozu b. Opening Bozu c. Closing Bozu

Article Text

Copyright (c) Technical Analysis Inc.

4

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

d. Long Black Line B. Short White Line ... a. Upper Shadow b. Lower Shadow c. Spinning Top d. Small Star C. White Umbrella Lines a. Hammer b. Hangman c. Inverted Hammer Our engine will locate patterns by group and classification and should return a reference of knowledge to a higher-level PRS. Candlesticks require both levels of PRS, one for single candles and one much larger for multi-candle patterns. Thus, we have begun to create a basic level of knowledge for our pattern recognition system. The system knows that there are three groups of data and as many assigned patterns as we care to define. At this stage, our system will return what it knows about a single canble and it will always fall into one of these three categories. For basic single candle formations, this is fine. But we still need to consider advanced patterns. We need to teach the system more complex patterns and how single candles relate to each other. Because of the complexity of advanced candlestick patterns, our high-level PRS must be extremely well organized and requires many extra data variables. The high-level pattern recognition system consists of tightly defined pattern assignments and, once again, a reference of knowledge. This high-level PRS uses a structure similar to its companion and it consists of different groups of advanced patterns and associations to other patterns. We use the data variables and references of knowledge created by the engine to assign each advanced pattern. One pattern group is the "harami," which is simply an inside day. Since many variations to this pattern exist, we need to make more distinctions. For example (Figure 7): if (CANDLE[0] == DOJI && CANDLE[- 1 ] == WHITE) { PATTERN = WHITE_HARAMI_CROSS; } could mean that we are seeing a white harami cross, but we would need to add the following to our formula: && (CANDLE[0] .CLOSE < CANDLE[-1 ] .CLOSE) && (CANDLE[0].CLOSE > CANDLE[-1].OPEN)

Article Text

Copyright (c) Technical Analysis Inc.

5

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

"Remember, Hagedorn, you no longer work for the private sector. In the public sector, the customer is never right." So the formula would look like: if (CANDLE[0] == DOJI && CANDLE[-1] == WHITE && (CANDLE[0] .CLOSE < CANDLE[-1] .CLOSE) && (CANDLE[0] .CLOSE >CANDLE[- 1] .OPEN) { PATTERN = WHITE_HARAMI_CROSS } We have now assigned a pattern that will isolate a white harami cross, as the body of the first candle (CANDLE[0]) is within the body of the previous candle (CANDLE[- 1] ) . Creating the pattern assignment for a black harami cross would not be difficult. The simplicity of defining pattern assignments is relative to the engine's complexity.

M

ultiple candles make up each advanced pattern. Often patterns may consist of three or more separate

candles, each in specific relation to one another. Sometimes, a pattern need only be based on shapes and locations, not the color and shape of each candle. In essence, we are teaching our pattern recognition system to associate patterns from a wide scope of knowledge. Now we need some form of logic to control and define what the PRS knows. Logic variables are similar to flags or road signs that guide the candlestick PRS to make the right choice. Using logic variables with your patterns organized from most critical to least critical ensures proper pattern recognition. Proper use of logic variables is critical to the operation of the PRS. If the PRS is guided illogically, you will end up with false information. WISDOM PLUS TECHNOLOGY Pattern recognition is nothing new in technical analysis. Accurate interpretation of advanced candlestick patterns has through several centuries provided insight and knowledge about market direction. By combining this experience and human wisdom with artificial intelligence methods, a computer can accurately interpret Japanese candlesticks and provide you with important information as to future market events.

Article Text

Copyright (c) Technical Analysis Inc.

6

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

When interpreting candlesticks, a pattern recognition system is only as good as its weakest link. The system is useless unless it provides all the necessary insight and information to advise the trader of possible future events. It is only in recent years that technological advances in PC hardware and software languages have provided us with ideal tools for advanced pattern recognition systems. In fact, it is only within the last year that these advances in technology have been applied to interpreting Japanese candlesticks. The Japanese technique of candlestick charting has taken price movement, broken it down and categorized it into valid groups and patterns that can indicate future market trends in a simple manner. By establishing trading rules and principles through a neural network and assigning numeric values to each group, artificial intelligence techniques can be applied to candlesticks and developed to analyze and associate patterns, or groups of patterns, with other technical studies to provide new insight into market analysis. Gary S. Wagner has been a registered commodity broker since 1984. Bradley L. Matheny is a systems analyst and has been developing custom software applications for eight years. They are currently technical lmarket analysis software developers for International Pacific Trading Company, and they co-developed The Candlestick Forecaster, a candlestick-interpretation program based on artificial intelligence.

REFERENCES Goldberg, David E. [1988]. Genetic Algorithms In Search, Optimization And Machine, Addison-Wesley. Heller, Martin [1991]. "AI in practice," BYTE, Volume 16, Number 1. Hymes, Dell [1964]. Language in Culture and Society, Harper & Row. International Pacific Trading Company,30011 Ivy Glenn, Suite 125, Laguna Niguel, CA 92677, (800) 347-5311. Nison, Steve [1991]. Japanese Candlestick Charting Techniques , Simon & Schuster. Seki, Shimizu [1986]. The Japanese Chart of Charts, Futures Trading Publishing Co. Thompson, Bill, and Bev Thompson [1991]. "Overturning the category bucket," BYTE, Volume 16, Number 1.

Figures

Copyright (c) Technical Analysis Inc.

7

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

FIGURE 1 The body can be filled in or empty. When the close is lower than the open the body is filled in; if the close is higher than the open the body is left empty.

FIGURE 2 The candle pattern called black doji line occurs when the opening and closing prices are almost equal. The black doji line often indicates a trend change or a market bottom or top.

Figures

Copyright (c) Technical Analysis Inc.

8

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

FIGURE 3 The black doji star pattern indicates that a reversal may be in sight. Traders should use caution at the sign of this pattern and look for a possible top or bottom.

FIGURE 4 The three river evening black doji star is composed of a dark cloud formation with a star gapped above the white or black candles. A bearish pattern, it signals a possible top.

Figures

Copyright (c) Technical Analysis Inc.

9

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

FIGURE 5 The long white line occurs when the open is lower than the close and the daily range Is greater than average. The close must be lower than the high and the open must be greater than the low. The pattern is considered bullish.

FIGURE 6 The daily ranges exceeds the average daily range but the close must be less than the high and the open must be greater than the low to be a long white line.

Figures

Copyright (c) Technical Analysis Inc.

10

Stocks & Commodities V. 9:9 (378-382): Pattern Recognition And Candlesticks by Gary S. Wagner and Bradley L. Matheny

FIGURE 7 The harami white cross may signal a trend change or reversal, especially when found near a new high. Traders are advised to wait for confirmation and look at previous candles to determine the direction of the trend

Figures

Copyright (c) Technical Analysis Inc.

11