The Camouflage Reversal Pattern
Coding the TD Camouflage Pattern and Analyzing its Predictability
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 the TD Camouflage 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 Camouflage Pattern
Tom Demark, the renowned famous technical analyst has created many indicators and patterns. Among his many discoveries, he came up with a few short-term patterns, among them is a pattern called Camouflage.
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.
Requirements for a TD Camouflage Buy entry:
The close of the current price bar must be below the close of the previous price bar.
The close of the current price bar must be above the open of the current price bar.
The low of the current price bar must be lower than the true low two price bars earlier.
Requirements for a TD Camouflage Sell short entry:
The close of the current price bar must be above the close of the previous price bar.
The close of the current price bar must be below the open of the current price bar.
The high of the current price bar high must be above the true high two price bars earlier.
To code this pattern, we need to define the primal manipulation functions first:
def adder(data, times):
for i in range(1, times + 1):
new = np.zeros((len(data), 1), dtype = float)
data = np.append(data, new, axis = 1)
return data
def deleter(data, index, times):
for i in range(1, times + 1):
data = np.delete(data, index, axis = 1)
return data
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 Camouflage or input -1 in case of a bearish Camouflage.
def td_camouflage(Data):
# Adding columns
Data = adder(Data, 20)
# True Low Calculation
for i in range(len(Data)):
Data[i, 5] = min(Data[i, 2], Data[i - 2, 2])
# True High Calculation
for i in range(len(Data)):
Data[i, 6] = max(Data[i, 1], Data[i - 2, 1])
# Bullish signal
for i in range(len(Data)):
if Data[i, 3] < Data[i - 1, 3] and Data[i, 3] > Data[i, 0] and Data[i, 2] < Data[i - 2, 5]:
Data[i, 7] = 1
# Bearish signal
for i in range(len(Data)):
if Data[i, 3] > Data[i - 1, 3] and Data[i, 3] < Data[i, 0] and Data[i, 1] > Data[i - 2, 6]:
Data[i, 8] = -1
# Cleaning
Data = deleter(Data, 5, 1)
return Data
Back-testing the Pattern With no Risk Management
The pattern will be back-tested in three 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. Finally, the third way will use a suboptimal risk-reward ratio of 0.20. This means that we will target one fifth the stop we set.
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 that uses 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 which will be covered in a later section below.
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 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.