Pattern recognition is a vast field and can have many innovative ideas or unexplored techniques. This article sheds some light on a type of pattern that can be applied in a different way.
For the complete collection of candlestick patterns in detail with back-tests and technical strategies, you can check out my newest book with O’Reilly Media. The book features a huge number of classic and modern candlestick patterns as it dwelves into the realm of technical analysis with different trading strategies. The book comes with its own GitHub and is dynamic in nature as it is continuously updated and questions are answered on the O’Reilly platform promptly.
Mastering Financial Pattern Recognition
Amazon.com: Mastering Financial Pattern Recognition eBook : Kaabar, Sofien: Kindle Storeamzn.to
What is a Pattern?
A market pattern refers to recurring and recognizable formations or trends in financial markets, such as stock markets, commodity markets, or foreign exchange markets. These patterns are observed in price charts and are based on historical price movements and trading volumes. Market patterns are used by traders and analysts to predict potential future price movements and make informed trading decisions.
There are various types of market patterns, each with its own characteristics and implications. Some common market patterns include:
Trend Patterns: These patterns show the general direction of price movement, such as uptrends (higher highs and higher lows) and downtrends (lower highs and lower lows).
Reversal Patterns: These patterns indicate a potential change in the prevailing trend. Examples include head and shoulders, double tops, and double bottoms. These patterns suggest that a trend may be reaching its end and a reversal could occur.
Continuation Patterns: These patterns suggest that the current trend is likely to continue after a brief consolidation period. Examples include flags, pennants, and triangles.
Candlestick Patterns: These patterns are derived from Japanese candlestick charts and provide insights into price movements. Examples include doji, hammer, and engulfing patterns.
And there is also the application of patterns on technical indicators. In this article, we’ll apply a candlestick pattern on the RSI and see what type of signals it may give. Let’s do a quick introductio to this pattern.
The Doji Pattern
Candlestick charts are among the most famous ways to analyze the time series visually. They contain more information than a simple line chart and have more visual interpretability than bar charts.
The Doji pattern is a one-candlestick contrarian configuration but we generally observe what happens before it and one candlestick after it so that we confirm the type of the Doji. The Doji’s general shape is a candlestick that resembles a plus sign which simply means that the close price equals the open price.
The bullish Doji is composed of a plus sign candlestick that has the open price equal to the close price. It should be followed by a confirmation bullish candlestick and preceded by a bearish candlestick. The following Figure shows a theoretical illustration of the bullish Doji.
The bearish Doji is composed of a plus sign candlestick that has the open price equal to the close price. It should be followed by a confirmation bearish candlestick and preceded by a bullish candlestick. The following Figure shows a theoretical illustration of the bearish Doji.
The Relative Strength Index (RSI)
The Relative Strength Index (RSI) is a technical indicator used in financial analysis to measure the magnitude of recent price changes in order to evaluate overbought or oversold conditions of an asset, such as stocks, commodities, or currencies. The RSI is displayed as an oscillator that ranges between 0 and 100, with readings typically plotted on a chart below the price chart.
The RSI is calculated using the following steps:
Calculate the average of the price gains and losses over a specific period (usually 14 periods). Price gains are the positive differences between consecutive closing prices, while price losses are the negative differences.
Calculate the relative strength (RS) by dividing the average of gains by the average of losses.
The RSI is then derived by applying the following formula: RSI = 100 — (100 / (1 + RS))
The RSI generates signals based on the concept that price tends to be overbought when it rises too quickly and overextended, and oversold when it falls too rapidly. Here’s how the RSI is interpreted:
Overbought (typically above 70): When the RSI reading crosses above the overbought threshold (e.g., 70), it suggests that the asset’s price may have risen too quickly and a potential reversal or correction could be on the horizon. Traders might consider selling or taking profits in such situations.
Oversold (typically below 30): When the RSI reading drops below the oversold threshold (e.g., 30), it indicates that the asset’s price may have declined too rapidly and a rebound or recovery could be imminent. Traders might consider buying or entering long positions in such cases.
It’s important to note that the RSI is a momentum oscillator and works best in ranging or sideways markets. In strongly trending markets, the RSI can stay overbought or oversold for extended periods, leading to false signals. Therefore, traders often use the RSI in combination with other technical indicators and analysis methods to enhance its reliability.
The RSI-Doji Pattern Recognition
The main aim is to apply the Doji pattern on the RSI. This implies calculating two RSI’s, one on the close price and the other on the open price. Whenever the two RSI’s are equal, a Doji pattern is validated. The following Figure shows the pattern in action:
The following shows how to code this pattern on the RSI using PineScript:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sofien-Kaabar
//@version=5
indicator("RSI - Doji", overlay = true)
lookback = input(defval = 14, title = 'Lookback')
rsi_open = math.round(ta.rsi(open, lookback), 1)
rsi_close = math.round(ta.rsi(close, lookback), 1)
bullish_pattern = rsi_close[1] == rsi_open[1] and ta.rsi(close, lookback) < 40
bearish_pattern = rsi_close[1] == rsi_open[1] and ta.rsi(close, lookback) > 60
plotshape(bullish_pattern, style = shape.triangleup, color = color.green, location = location.belowbar, size = size.small)
plotshape(bearish_pattern, style = shape.triangledown, color = color.red, location = location.abovebar, size = size.small)
It’s worth noting that the pattern is improved if you combine it with the same pattern applied on the market price.
The following Figure shows more signals:
The following Figure shows more signals:
Are you interested in market sentiment and its strength to deliver powerful market forecasts? If so, then you can check out my other newsletter The Weekly Market Sentiment Report. It’s a weekly newsletter that highlights and explains the key market configurations using powerful market sentiment indicators and strategies!