More Pattern Recognition Tools to Up Your Trading
Developing a New Collection of Market Patterns
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 Kangaroo Tail 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 Kangaroo Tail pattern (as presented by Alex Nekritin and Walter Peters) is a one-candlestick reversal configuration that has roots in classic candlestick patterns (namely the hammer and Doji patterns), therefore, it may resemble them but with a few extra conditions to filter false signals.
The bullish Kangaroo Tail is composed of a very long wick where the open and close price are in the upper two thirds of the candle’s range (the high minus the low). Similarly, it must be in a down trend with a range that is superior to the prior candlesticks (to avoid what is known as a runaway). Some minor conditions are in the code.
The bearish Kangaroo Tail is composed of a very long wick where the open and close price are in the lower two thirds of the candle’s range (the high minus the low). Similarly, it must be in an up trend with a range that is superior to the prior candlesticks (to avoid what is known as a runaway). Some minor conditions are in the code.
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-KangarooTail Pattern Recognition
The main aim is to apply the Kangaroo Tail 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 Kangaroo Tail 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 - Kangaroo Tail", overlay = true)
lookback = input(defval = 14, title = 'Lookback')
look_to_the_left = 200
rsi_open = math.round(ta.rsi(open, lookback), 1)
rsi_high = math.round(ta.rsi(high, lookback), 1)
rsi_low = math.round(ta.rsi(low, lookback), 1)
rsi_close = math.round(ta.rsi(close, lookback), 1)
candle_range = rsi_high - rsi_low
two_third_candle_range = candle_range * 0.66
bullish_pattern = rsi_close > (two_third_candle_range + rsi_low) and rsi_open > (two_third_candle_range + rsi_low) and rsi_close > rsi_low[1] and rsi_close < rsi_high[1] and rsi_open > rsi_low[1] and rsi_open < rsi_high[1] and rsi_close < rsi_close[look_to_the_left] and candle_range > candle_range[1] and candle_range > candle_range[2] and candle_range > candle_range[3] and rsi_close[1] < rsi_open[2] and rsi_low <= ta.lowest(rsi_low, 55)
bearish_pattern = rsi_close < (rsi_high - two_third_candle_range) and rsi_open < (rsi_high - two_third_candle_range) and rsi_close > rsi_low[1] and rsi_close < rsi_high[1] and rsi_open > rsi_low[1] and rsi_open < rsi_high[1] and rsi_close > rsi_close[look_to_the_left] and candle_range > candle_range[1] and candle_range > candle_range[2] and candle_range > candle_range[3] and rsi_close[1] > rsi_open[1] and rsi_high >= ta.lowest(rsi_high, 55)
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)
The following Figure shows more signals:
Careful as this pattern is just for demonstrative purposes only. The previous pattern shared on the RSI is better. This article is just to show you how to apply these patterns on the RSI. If a pattern stands out (results-wise), it will be mentioned.
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!