Exploring Pattern Recognition in Waldo Trading Strategies
Written on
Chapter 1: Understanding Pattern Recognition
Pattern recognition involves identifying recurring sequences that yield similar results. Essentially, when we discern a pattern, it allows us to anticipate outcomes that guide our trading decisions. For instance, the head and shoulders formation is a well-known technical pattern signaling a potential trend reversal. Opinions vary regarding the predictive power of this iconic setup.
In this discussion, we will explore some unique objective patterns, which are defined by clear rules, as opposed to classic formations like head and shoulders or double tops/bottoms. Previously, we covered TD Waldo #8; now, we will focus on TD Waldo #5, another timing and reversal pattern introduced by Tom Demark.
I have recently published a new book, following the success of "Trend Following Strategies in Python." This latest release includes advanced contrarian indicators and strategies, with ongoing updates available on a dedicated GitHub page. If you're interested, you can purchase the PDF version for 9.99 EUR via PayPal. Please include your email in the note to ensure it reaches you correctly, and remember to download it from Google Drive.
Chapter 2: Coding the TD Waldo Pattern #5
Tom Demark, a highly regarded technical analyst, has developed various indicators and price patterns, notably seven distinct formations known as "Waldo patterns," inspired by the "Where's Waldo?" concept. These patterns are designed to help traders identify short-term peaks and troughs. While many traders are eager to learn about these patterns, confirmation bias often leads them to focus only on successful instances, neglecting those that fail. The solution lies in creating a systematic trading approach based on these patterns, which is the focus of this section.
To identify a potential short-term bottom and a buying opportunity:
- The closing price of the current bar must match that of the previous bar.
- The closing price of the previous bar should be lower than that of the bar preceding it.
To identify a potential short-term top and a selling opportunity:
- The closing price of the current bar must equal the closing price of the previous bar.
- The closing price of the previous bar should exceed that of the bar before it.
Below are examples of EURUSD and USDCHF signal charts illustrating the pattern.
Assuming we have an OHLC array with some empty columns, we can utilize the following scanner to identify the pattern and mark it with 1 for a bullish Waldo #5 or -1 for a bearish Waldo #5.
def td_waldo_5(Data, high, low, close, buy, sell):
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] = -1return Data
I have recently partnered with Lumiwealth, offering resources to help you develop various algorithms. They provide comprehensive courses on algorithmic trading, blockchain, and machine learning that I highly recommend.
Chapter 3: Back-Testing the Pattern Without Risk Management
The back-testing of this pattern will be conducted in two phases. The first phase, discussed here, will not incorporate risk management. Positions will be opened and closed based solely on closing prices and subsequent signals. The second phase will implement a theoretical 2:1 risk-reward ratio, which involves setting a stop loss at half the distance of the profit target from the entry point.
The parameters for the back-test are as follows:
- The time frame is hourly, starting from 2010, with a 0.2 pip spread to simulate institutional algorithm trading.
- Positions open based on signals and exit upon receiving another signal, whether the same or contrary.
- Equity curves without a theoretical risk-reward ratio indicate a concerning trend for any algorithm employing this pattern, which is advantageous for brokers trading against you.
Chapter 4: Back-Testing with a 2:1 Risk-Reward Ratio
To mitigate risk while seeking greater returns, implementing a theoretical 2:1 risk-reward ratio is essential. This is achieved using the Average True Range (ATR) indicator for determining stop and profit levels.
The back-test conditions remain similar:
- The time frame is hourly, starting from 2010, using a 0.2 pip spread.
- Positions open on signals, exiting upon receiving another signal.
- Stop losses trigger when the current price reaches 1x the ATR value at entry.
- Profit orders execute when the price reaches 2x the ATR value at entry.
While this strategy appears to perform worse overall, it remains crucial to conduct thorough back-testing. Always remember that your personal trading indicators and methods may not suit everyone.
Chapter 5: Key Takeaways
In conclusion, my aim is to contribute to the realm of objective technical analysis by promoting transparent techniques and strategies that must be back-tested prior to application. This approach can enhance the credibility of technical analysis, which often suffers from a reputation for being subjective and lacking scientific backing.
For those exploring trading techniques, I recommend the following steps:
- Maintain a critical mindset and avoid emotional decisions.
- Back-test strategies under real-world conditions.
- If promising, optimize and conduct forward testing.
- Always factor in transaction costs and potential slippage.
- Implement risk management and position sizing within your tests.
Ultimately, remain vigilant and monitor your strategies, as market dynamics can change, potentially rendering a previously successful strategy unprofitable.
This video titled "Pattern Recognition [PR] Episode 1 - Introduction" provides insights into the fundamentals of pattern recognition in trading.
The second video, "Pattern Recognition - The Big Picture," expands on the broader implications of recognizing patterns for trading success.