Available translations

Candle Patterns - Buddah Indicator

foundations.png
Summary: The indicator features a pattern-recognition algorithm classifying candles in multiple groups such as Classic Candles, Marubozu Candles, Spinning Top Candles, Doji Candles, and grouping pattern into on, two, and three-candle sequences.
Candle Patterns On the Charts
Before we may identify elaborate candle patterns, basic candles must be defined, grouped, and parameterized. Patterns may be made up of one or more candles. For this reason, the Candle Patterns indicator features a layer for basic candles and a layer for each group of patterns.
Basic Candles
The starting point to search for candle patterns is to establish standard criteria to name each candle. Because candles are made up of four prices, this gives rise to a large number of possible combinations. For example, there may be candles with one, two, or without shadows, which may be big or small relative to the body of the candle, which itself may be big or small in relation to other candles, and so on.
The Basic Candles layer features two blue lines and an orange one.
  • The blue line in the bottom connects the low price of each candle.
  • The blue line on top results from averaging the length of the last ten candles and adding it to the low value of the current candle.
  • The orange line in the middle is calculated by multiplying the distance between the two blue lines by an arbitrary sizeFactor.
Therefore, the range between the blue lines is said to represent the average length of candles. The orange line in the middle serves to determine if a candle is short or long in relation to other candles. If the high of a candle lies above the orange line, it is said to be a Long candle, otherwise, it is a Short candle.
The corresponding layer panel features the following properties for each candle:
Indicator Properties Description
Name The name of the basic candle.
Size The relative size of the candle: Short or Long.
Upper Shadow % The percentage that the upper shadow covers in the total length of the candle.
Body % The percentage that the body represents in the total length of the candle.
Lower Shadow % The percentage that the lower shadow represents in the total length of the candle.
Nbodies The number of previous candles used to calculate the body average.
dojiFactor % A limit to the size of the body expressed as a percentage of the total length for a candle to be considered a doji.
sizeFactor % A factor used to calculate the orange line, which determines the relative size of candles, expressed as a percentage of the average length of the last few candles.
Nlengths The number of previous candles used to calculate the average candle lengths.
Average Size Method The method used to calculate the average of the total lengths of previous candles.
Below is the complete list of basic candles, grouped by families relative to certain characteristics they have in common.
Classic Candles
These candles have the following characteristics in common:
  • Both shadows are present.
  • Each shadow is shorter than the body.
  • The opening price differs from the closing price.
According to their particular characteristics, they are named as follows:
  • Basic candle name: short green candle, short red candle.
  • Particular Characteristics: bullish or bearish, relative size: short.
  • Basic candle name: green candle, red candle.
  • Particular Characteristics: bullish or bearish, relative size: long.
  • Basic candle name: long green candle, long red candle.
  • Particular Characteristics: bullish or bearish, relative size: the body is at least three times higher than the average of the previous bodies.
Marubozu Candles
These candles have the following characteristics in common:
  • Lack of at least one shadow.
  • If it has one shadow, it must be shorter than the body.
  • The opening price differs from the closing price.
  • Relative Size: Short or Long.
According to their particular characteristics, they are named as follows:
  • Basic candle name: green marubozu, red marubozu.
  • Particular Characteristics: bullish or bearish, no shadows.
  • Basic candle name: opening green marubozu.
  • Particular Characteristics: bullish, no lower shadow.
  • Basic candle name: closing green marubozu.
  • Particular Characteristics: bullish, no upper shadow.
  • Basic candle name: opening red marubozu.
  • Particular Characteristics: bearish, no upper shadow.
  • Basic candle name: closing red marubozu.
  • Particular Characteristics: bearish, no lower shadow.
Spinning Top Candles
These candles have the following characteristics in common:
  • Have at least one shadow.
  • At least one shadow is greater than the body.
  • The opening price differs from the closing price.
According to their particular characteristics, they are named as follows:
  • Basic candle name: green spinning top, red spinning top.
  • Particular Characteristics: bullish or bearish, relative size: short or long. If it's relative size is long, none of the shadows can exceed three times the body.
  • Basic candle name: high wave.
  • Particular Characteristics: bullish or bearish, relative size: long. The length of at least one shadow is at least 3 times larger than the body.
Doji Candles
These candles have the following characteristics in common:
  • Have no body, or very small body if it is allowed.
According to their particular characteristics, they are named as follows:
  • Basic candle name: Four-Price Doji
  • Particular Characteristics: No shadows. Relative Size: Short.
  • Basic candle name: Star Doji
  • Particular Characteristics: The body is located nearly mid-range (between 60% and 40% of total length). Relative Size: Short.
  • Basic candle name: Long-Legged Doji
  • Particular Characteristics: The body is located nearly mid-range (between 60% and 40% of total length). Relative Size: Long.
  • Basic candle name: Dragonfly Doji
  • Particular Characteristics: Upper shadow shorter than 1% of total candle length. Relative Size: Long.
  • Basic candle name: Gravestone Doji
  • Particular Characteristics: Lower shadow shorter than 1% of total candle length. Relative Size: Long.
  • Basic candle name: Generic Doji
  • Particular Characteristics: All doji candles that do not match the 5 mentioned above.
One-Candle Patterns
One-Candle Patterns consist of a single basic candle in a certain market context. Matching the type of basic candle with the analysis of the context in terms of the current trend as indicated by a 10-period exponential moving average (EMA) may help predict reversals or continuations.
The layer features an EMA 10 drawn with a dark line. It also features green and red arrows below and above the one-candles patterns, indicating the position in which the pattern appears.
If the candle is green and is pointing up, the pattern indicates a “Bullish Reversal” or a “Bullish Continuation” forecast when it’s trending downwards or upwards respectively. If the candle is red and is pointing down, it indicates a “Bearish Reversal” or “Bearish Continuation” forecast when the trend is up or down respectively.
The panel features the following properties:
Indicator Properties Description
Pattern Name The name of the pattern.
Trend Direction The market trend on which the pattern has formed, as indicated by the EMA 10.
Forecast The prediction given by the pattern forming in the current trend.
Trend Line Method The method used to calculate the moving average that represents the trend line.
Trend Line Period The number of periods used to calculate the moving average.
Trend Line Value The current value of the moving average.
Two-Candles Patterns
Two-Candles Patterns are built from two basic candles.
When analyzing patterns of more than one candle, it is important to understand the following concepts:
  • The first candle in the pattern is the first candle that is formed chronologically, and so on for the following candles.
  • The first candle in the pattern is the one that defines the trend of the pattern. For this reason, the value and the direction of the trend line of the pattern corresponding to the trend line of the first candle.
  • The arrow is drawn on the last candle that forms the pattern.
Three-Candles Patterns
Three-Candles Patterns are built from three basic candles.
Candle Patterns Products & Properties
Product Name Product Variable Property Variables
Basic Candles basicCandle name, size, direction, upperShadow, body, lowerShadow, length, meanBody, meanLength
One-Candle Patterns oneCandlePattern name, trend, forecast, trendLine
Two-Candles Patterns twoCandlePattern name, trend, forecast, trendLine
Three-Candles Patterns threeCandlePattern name, trend, forecast, trendLine
Examples:
 chart.at24hs.basicCandle.name === "Long Green Candle"
Is Long Green Candle the name of the current basic candle?
 chart.at24hs.basicCandle.upperShadow > chart.at24hs.basicCandle.body
Is the upper shadow longer than the body?
Basic Candles
Variable Description Possible Values
name The name that has been assigned to the basic candle. Short Green Candle, Short Red Candle, Green Candle, Red Candle, Long Green Candle, Long Red Candle, Green Marubozu, Opening Green Marubozu, Closing Green Marubozu, Red Marubozu, Opening Red Marubozu, Closing Red Marubozu, Red Spinning Top, Green Spinning Top, High Wave, Four-Price Doji, Star Doji, Long-Legged Doji, Dragonfly Doji, Gravestone Doji, Generic Doji
size The relative size of the candle short, long
direction Indicates if it’s a bullish or a bearish candle bullish, bearish
upperShadow The length of the upper shadow
body The length of the body
lowerShadow The length of the lower shadow
length The total length of the candle (candle.max - candle.min)
meanBody The moving average of the length of the bodies of previous candles
meanLength The moving average of the total length of previous candles
One-Candle Patterns
Variable Description Predefined Values
name The name assigned to the pattern Bearish Strong Line, Bearish Belt Hold, Hanging Man, Shooting Star, Bullish Belt Hold, Hammer, Bullish Strong Line
trend The market trend during which the pattern has formed Uptrend, Downtrend
forecast It is the possible future scenario that represents the formation of this pattern Bullish Continuation, Bullish Reversal, Bearish Continuation, Bearish Reversal
trendLine The value of the Moving Average that represents the trend line on which the pattern was formed
Two-Candles Patterns
Variable Description Predefined Values
name It is the name that has been assigned to the pattern based on the configuration of the candles that make it up Last Engulfing Bottom, Bearish Engulfing, Bearish Harami, Bearish Harami Cross, Bearish Tasuki Line, Descending Hawk, Tweezers Top, Two-Candle Shooting Star, Last Engulfing Top, Bullish Engulfing, Bullish Harami, Bullish Harami Cross, Bullish Tasuki Line, Tweezers Bottom
trend The market trend during which the pattern has formed Uptrend, Downtrend
forecast It is the possible future scenario that represents the formation of this pattern Bullish Continuation, Bullish Reversal, Bearish Continuation, Bearish Reversal
trendLine The value of the Moving Average that represents the trend line on which the pattern was formed
Three-Candles Patterns
The following table details the variables that can be used in the conditions of the trading strategies:
Variable Description Predefined Values
name It is the name that has been assigned to the pattern based on the configuration of the candles that make it up Advance Block, Deliberation, Identical Three Crows, Three Inside Down, Three Outside Down, Three Inside Up, Three Outside Up
trend The market trend during which the pattern has formed Uptrend, Downtrend
forecast It is the possible future scenario that represents the formation of this pattern Bullish Continuation, Bullish Reversal, Bearish Continuation, Bearish Reversal
trendLine The value of the Moving Average that represents the trend line on which the pattern was formed
Calculation Parameters
Basic Candles
The following table details the parameters that may be configured in the code of the indicator products:
Parameter Description Default Value Normal Values
Nbodies The number of previous candle bodies used to calculate “meanBody” 10 5 to 20
dojiFactor It is the maximum percentage allowed for the body in relation to the length for the candle to be included in the Doji family 3 0 to 5
sizeFactor It is the percentage of the “meanLength” used to determinate the “size” of a candle (orange line on the chart) 75 60 to 80
Nlengths The number of previous candle lengths used to calculate “meanLength” 20 10 to 25
sizeMethod The method used to calculate “meanLength” EMA SMA or EMA
Candle Patterns
The following table details the parameters that may be configured in the code of the indicator products:
Parameter Description Default Value Normal Values
N It is the period of the moving average used to calculate the trend line 10 5 to 20
trendMethod The method used to calculate the trend line Moving Average EMA SMA or EMA
The Theory Behind Candle Patterns
Introduction
Candle patterns are a versatile tool that traders use to visually estimate the sentiment of market participants. The logic implemented in this indicator was distilled from content in the following works:
  • “Candlestick Charting Explained” - Author: Greg Morris
  • “Technical Analysis of The Financial Markets” - Author: John J. Murphy
  • “Encyclopedia of Candlestick Charts” - Author: Thomas N. Bulkowski
  • “Encyclopedia of Chart Patterns” - Author: Thomas N. Bulkowski
  • “Japanese Candlestick Charting Techniques” - Author: Steve Nison
You may also wish to visit the following sources:
  • Thomas Bulkowski: ThePatternSite.com
  • Investopedia: Introduction to Technical Analysis Price Patterns
  • CandleSticker by American Bulls
Parts of a Candle
Let’s start by agreeing on the basic vocabulary to describe candles.
The first price from which the candle begins to form is the open price. The last price from which the candle finishes forming is the close price. The distance between both prices is called body. Market volatility may cause the price to fluctuate beyond both prices during candle formation, creating shadows. The upper shadow is the line that links the maximum price with the body. The lower shadow is the line that links the min price with the body.
Regarding color:
  • When the closing price is greater than the open price, the body of the candle is green. This indicates that it is a bullish candle.
  • When the closing price is lesser than the open price, the body of the candle is red. This indicates that it is a bearish candle.
Body of Doji Candles
Japanese candle theory defines a doji candle as one in which the closing price equals the opening price. In other words, a doji candle should have no body. In practice, the following aspects must be taken into account:
  • Price volatility
  • The precision with which prices are recorded
These two factors make it very unlikely that both prices match exactly and—in practice—there is always a body, even if it is very small. For this reason, we define a range of uncertainty in body length to determine whether a candle is a doji or not. By default, we assume that the doji’s body may be equal or lesser than 3% of the total length of the candle. This is the dojiFactor.
Relative Size: Short or Long
It is very important to understand this concept since during the study and identification of candle patterns we must differentiate the size of each particular candle, that is, which ones are long and which are short. Intuitively, this seems simple, but translating the logic into an algorithm requires defining what tools will be used and how they will be parameterized.
To start, we need to establish some reference to decide what is long and what is short, since a long candle in some market context may be short in another context. When we look at a chart, our sight may deceive us since the context around a candle involves both past and future candles. However, when our algorithm is working on a live session, it may only see candles in the past.
It may be deduced that the average of the size of a certain number of past candles must be used as the frame of reference. This method arises from common sense and therefore it is the one observed to be widely used in the literature. Some authors differ in their criteria averaging only the bodies or averaging the total lengths including also the shadows.
For this reason, we have made both criteria available:
  • Body average: Bulkowski uses this criterion to detect candles of the type Long Green Candle and Long Red Candle. Since they are a particular case that occurs when the size of the body extends more than three times compared to the previous candle’s body average.
  • Length average: this criterion is used in a general manner, for all basic candles, since it also includes doji candles which have no body (or have very small bodies); with the previous criterion they would always be sized as Short, which is not what we are looking for.
Pattern Validation
To find candle patterns on the chart, it is necessary to analyze the market context in which the basic candles appear and how they are related to each other. For this reason, the following concepts are necessary:
  • Trend Line: To determine if prices are in an Uptrend or a Downtrend, a reference trend line is necessary, which is generally a moving average.
  • Minimum Trend Candles: It is the minimum number of candles that must be on the same trend line to validate a pattern. By default, 3 candles will be used.
Forecast:
  • Bullish Reversal: In a downtrend, a pattern is considered valid when the body of the first candle is below the trend line.
  • Bullish Continuation: In an uptrend, a pattern is considered valid when at least open prices of all pattern candles are above the trend line.
  • Bearish Reversal: In an uptrend, a pattern is considered valid when the body of the first candle is above the trend line.
  • Bearish Continuation: In a downtrend, a pattern is considered valid when at least open prices of all candles are below the downtrend.

Buddha Data Mine — TOC

You just read page 1 in the topic.

1. Candle Patterns - Buddah Indicator