Pattern Recognition on Another Waldo Pattern
Coding the TD Waldo #5 Market Pattern. Is this a Good Pattern?
Pattern recognition is the search and identification of recurring patterns with approximately similar outcomes. This means that when we manage to find a pattern, we have an expected outcome that we want to see and act on through our trading. For example, a head and shoulders pattern is a classic technical pattern that signals an imminent trend reversal. The literature differs on the predictive ability of this famous configuration.
In this article, we will discuss some exotic objective patterns. I say objective because they have clear rules unlike the classic patterns such as the head and shoulders and the double top/bottom. In a previous article, the light was on TD Waldo #8, in this one, we will discuss the TD Waldo #5 another timing and reversal pattern presented by Tom Demark.
I have just released a new book after the success of the previous book. It features advanced trend following indicators and strategies with a GitHub page dedicated to the continuously updated code. Also, this book features the original colors after having optimized for printing costs. If you feel that this interests you, feel free to visit the below Amazon link, or if you prefer to buy the PDF version, you could contact me on LinkedIn.
Trend Following Strategies in Python: How to Use Indicators to Follow the Trend.
Amazon.com: Trend Following Strategies in Python: How to Use Indicators to Follow the Trend.: 9798756939620: Kaabar…www.amazon.com
Coding the TD Waldo Pattern #5
Tom Demark, the renowned famous technical analyst has created many indicators and patterns. Among his many discoveries, he came up with 7 different price patterns that would dub as “Waldo patterns”.
Inspired by the cartoon Where’s Waldo? Tom has developed these patterns to find short-term tops and bottoms. Any trader or even a receiver of such information would be excited knowing about this, but with hindsight and confirmation bias, the person seeing this, will test the patterns on the chart and focus on the ones that work while disregarding the ones that do not. The only way to remedy this problem is by developing a systematic trading strategy based on these patterns, and that is precisely what we are going to do.
To find a potential short-term bottom and a long opportunity:
The close of the current bar should be equal to the close of the previous bar.
The close of the previous bar should be lower than the close of the bar before that.
To find a potential short-term top and a short-sell opportunity:
The close of the current bar should be equal to the close of the previous bar.
The close of the previous bar should be lower than the close of the bar before that.
To code this indicator, we need to define the primal manipulation functions first:
# The function to add a certain number of columns
def adder(Data, times):
for i in range(1, times + 1):
z = np.zeros((len(Data), 1), dtype = float)
Data = np.append(Data, z, axis = 1)
return Data
# The function to deleter a certain number of columns
def deleter(Data, index, times):
for i in range(1, times + 1):
Data = np.delete(Data, index, axis = 1)
return Data
# The function to delete a certain number of rows from the beginning
def jump(Data, jump):
Data = Data[jump:, ]
return Data
Assuming we have an OHLC array, we can define and use the scanner below that will look for the pattern and input 1 in case of a bullish Waldo #5 or input -1 in case of a bearish Waldo #5.
def td_waldo_5(Data, high, low, close, buy, sell):
# Adding a few columns
Data = adder(Data, 10)
Data = rounding(Data, 4)
for i in range(len(Data)):
# Short-term Bottom
if Data[i, 3] == Data[i - 1, 3] and Data[i - 1, 3] < Data[i - 2, 3]:
Data[i, buy] = 1
# Short-term Top
if Data[i, 3] == Data[i - 1, 3] and Data[i - 1, 3] > Data[i - 2, 3]:
Data[i, sell] = -1
return Data
Back-testing the Pattern With no Risk Management
The pattern will be back-tested in two ways. The first which is covered in this section, does not use any risk management. It opens and closes positions on closing prices and upon the next signal. The second way is to use the optimal 2.0 risk-reward ratio which is simply setting the stop at half the distance from the entry compared to the distance of the profit level from the entry.
The below are the conditions of the back-test:
The time frame is hourly since 2010 using a 0.2 pip spread in order to simulate an institutional algorithm.
Opening of the position is based on a signal and its exit is based on finding another signal whether the same or a contrarian one.
It looks like a free fall for any algorithm to use this pattern. This is music to the ears of brokers who are looking to trade against you.
If you are also interested by more technical indicators and strategies, then my book might interest you:
The Book of Trading Strategies
Amazon.com: The Book of Trading Strategies: 9798532885707: Kaabar, Sofien: Bookswww.amazon.com
Back-testing the Pattern With 2:1 Risk-Reward Ratio
Intuitively, we need to risk less than we expect to gain and therefore by setting a theoretical 2.0 risk-reward ratio, we are respecting this risk management technique. The way we theoretically set this ratio is by using an indicator called the Average True Range.
The below are the conditions of the back-test:
The time frame is hourly since 2010 using a 0.2 pip spread in order to simulate an institutional algorithm.
Opening of the position is based on a signal and its exit is based on finding another signal whether the same or a contrarian one.
Stops are triggered when the current quote hits 1x the value of the Average True Range at entry.
Profit orders are triggered when the current quote hits 2x the value of the Average True Range at entry.
The strategy seems to perform worse but is still overall extremely painful to look at.
Remember to always do your back-tests. You should always believe that other people are wrong. My indicators and style of trading may work for me but maybe not for you.
I am a firm believer of not spoon-feeding. I have learnt by doing and not by copying. You should get the idea, the function, the intuition, the conditions of the strategy, and then elaborate (an even better) one yourself so that you back-test and improve it before deciding to take it live or to eliminate it. My choice of not providing specific Back-testing results should lead the reader to explore more herself the strategy and work on it more.
One Last Word
I have recently started an NFT collection that aims to support different humanitarian and medical causes. The Society of Light is a set of limited collectibles which will help make the world slightly better as each sale will see a percentage of it sent directly to the charity attributed to the avatar. As I always say, nothing better than a bullet list to outline the benefits of buying these NFT’s:
High-potential gain: By concentrating the remaining sales proceedings on marketing and promoting The Society of Light, I am aiming to maximize their value as much as possible in the secondary market. Remember that trading in the secondary market also means that a portion of royalties will be donated to the same charity.
Art collection and portfolio diversification: Having a collection of avatars that symbolize good deeds is truly satisfying. Investing does not need to only have selfish needs even though there is nothing wrong with investing to make money. But what about investing to make money, help others, and collect art?
Donating to your preferred cause(s): This is a flexible way of allocating different funds to your charities.
A free copy of my book in PDF: Any buyer of any NFT will receive a free copy of my latest book shown in the link of the article.