Discover more from All About Trading!
Pattern Recognition Trading — The Five Spikes
Presenting and Coding the Five Spikes Pattern
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.
Introduction to Candlesticks
Candlestick charts are a widely used form of financial charting that visually represents the price movements of an asset over a specific period of time. These charts provide traders and analysts with valuable insights into the price dynamics of stocks, commodities, currencies, and other financial instruments. Candlestick charts originated in Japan in the 18th century and were used to track the price movements of rice, but they have since become a staple tool in modern technical analysis.
The primary purpose of candlestick charts is to display the open, high, low, and closing prices of an asset for a given time interval, such as a day, week, or month. Each time interval is represented by a single “candlestick,” which consists of a rectangular body and two lines extending from the top and bottom of the body, known as wicks.
Here’s a breakdown of the different components of a candlestick:
Body: The rectangular portion of the candlestick represents the price range between the opening and closing prices of the asset for the given time period. The body is usually filled with color, either green (or white) to indicate a price increase (bullish movement), or red (or black) to indicate a price decrease (bearish movement).
Wicks: The lines extending from the top and bottom of the body are called wicks or shadows. The upper wick extends from the top of the body to the highest price reached during the time period, while the lower wick extends from the bottom of the body to the lowest price reached. Wicks provide additional information about the price range and the market sentiment during the period.
Open and close prices: The top or bottom edge of the body represents the opening price (where the asset started trading) and the closing price (where the asset ended trading) for the time period. If the closing price is higher than the opening price, the body is typically filled with a bullish color (e.g., green). If the closing price is lower, the body is typically filled with a bearish color (e.g., red).
Candlestick patterns, formed by combinations of one or more candlesticks, are crucial for technical analysis. Traders and analysts use these patterns to identify potential trends, reversals, and market sentiment shifts. Some common candlestick patterns include doji, hammer, engulfing, shooting star, and spinning top, among others.
Overall, candlestick charts provide a visual representation of price movements that can help traders make informed decisions about buying, selling, or holding assets. They offer insights into market psychology, such as the battle between bulls and bears, and can be a powerful tool for both short-term and long-term trading strategies.
Introduction to the RSI
The RSI is a popular technical indicator used in financial analysis to measure the magnitude of recent price changes and evaluate the speed and direction of a price trend. Developed by J. Welles Wilder in 1978, the RSI is widely used by traders and analysts to identify overbought and oversold conditions in various financial markets, including stocks, commodities, currencies, and indices.
The RSI is presented as a numerical value that ranges between 0 and 100. It compares the average of recent upward price movements (gains) to the average of recent downward price movements (losses) over a specified period of time. This comparison is then transformed into an oscillator that oscillates between the 0 and 100 range, with certain levels often considered significant:
Overbought zone: Typically, an RSI value above 70 is considered an indication that the asset might be overbought. This means that the price has risen significantly and may be due for a potential reversal or correction.
Oversold zone: Conversely, an RSI value below 30 is often interpreted as the asset being oversold. This suggests that the price has fallen significantly and could potentially see a rebound or upward correction.
Here’s how the RSI is calculated step by step:
Calculate the smoothed average gains and average losses over a specified period. Average Gain = Sum of gains over the specified period / Number of periods. Average Loss = Sum of losses over the specified period / Number of periods
Calculate the relative strength (RS) by dividing the Average Gain by the Average Loss: RS = Average Gain / Average Loss
Calculate the RSI using the following formula: RSI = 100 — (100 / (1 + RS))
The RSI generates signals based on the movement of its value and its position relative to the overbought and oversold levels. Traders often look for the following types of signals:
Divergence: If the RSI and the price movement are moving in opposite directions, it might signal a potential trend reversal.
Overbought and oversold conditions: When the RSI crosses above the overbought threshold (70), it might suggest a potential pullback or reversal. Similarly, when it crosses below the oversold threshold (30), it might indicate a potential upward move.
RSI trendline: Traders sometimes draw trendlines on the RSI chart to identify patterns that can provide insights into potential price trends.
RSI pattern recognition: Traders can use certain patterns (namely candlesticks) on the RSI. This is the aim of the article.
It’s important to note that while the RSI can be a valuable tool in technical analysis, it should be used in conjunction with other indicators and analysis methods to make well-informed trading decisions. Additionally, market conditions can sometimes lead to extended periods of overbought or oversold levels, so it’s crucial to consider the broader context when interpreting RSI signals.
The Five Spikes RSI Pattern
The hidden shovel pattern gets its name from how it looks. To differentiate it from the gravestone or the dragonfly doji pattern on the price candlesticks, this pattern applies on the RSI. The first step before detecting the pattern is to create the Candlestick RSI indicator, which is simply four RSI calculations with each on the open, high, low, and close values, thus giving an RSI that can be charted as a candlestick system. The next step is to find the conditions of the pattern on the Candlestick RSI.
The conditions of the pattern are as follows:
A bullish pattern occurs whenever there’s five consecutive spike-like structures that appear on the RSI where each of the low-RSI values are below 23.6.
A bearish pattern occurs whenever there’s five consecutive spike-like structures that appear on the RSI where each of the high-RSI values are above 76.4.
The following shows a bearish signal (notice the five spikes that gave off the signal, the horizontal line is 76.4):
The following shows a bullish signal:
The following shows a few signals generated by the pattern:
The five spikes pattern is related to the concept of rejecting a certain level enough times for the traders to abandon trying to break it.
The code for the pattern is as follows:
// 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("Candlestick RSI - The Five Spikes", overlay = true) lookback = input(defval = 13, title = 'Lookback') open_price = math.round(ta.rsi(open, lookback), 1) high_price = math.round(ta.rsi(high, lookback), 1) low_price = math.round(ta.rsi(low, lookback), 1) close_price = math.round(ta.rsi(close, lookback), 1) bullish_pattern = low_price < 23.6 and open_price > 23.6 and close_price > 23.6 and low_price < 23.6 and open_price > 23.6 and close_price > 23.6 and low_price < 23.6 and open_price > 23.6 and close_price > 23.6 and low_price < 23.6 and open_price > 23.6 and close_price > 23.6 and low_price < 23.6 and open_price > 23.6 and close_price > 23.6 bearish_pattern = high_price > 76.4 and open_price < 76.4 and close_price < 76.4 and high_price > 76.4 and open_price < 76.4 and close_price < 76.4 and high_price > 76.4 and open_price < 76.4 and close_price < 76.4 and high_price > 76.4 and open_price < 76.4 and close_price < 76.4 and high_price > 76.4 and open_price < 76.4 and close_price < 76.4 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)
Pattern recognition is a powerful technique used in trading and technical analysis to identify and interpret recurring patterns in price charts and other market data. These patterns can provide valuable insights into potential price movements, trends, and reversals. Use them wisely and do not think that these pattern guarantee anything.
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!