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 Clopwin another timing and reversal pattern presented by Tom Demark.
The Fibonacci Trading Book is finally out! Filled with Fibonacci-based trading methods (tools, indicators, patterns, and strategies), this book will guide you through improving your trading and analysis by incorporating an important technical analysis approach that is Fibonacci. (Link to pay in PayPal for the PDF version at the end of the article)
Coding the TD Clopwin 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 Clopwin.
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.
Coding the Pattern in Pine Script
The pattern has a few conditions to get validated. Notice that this pattern’s back-tests have shown that it does not work and the following is purely for educational purposes.
Requirements for a TD Clopwin Buy entry:
The open and close of the current price bar must be contained within the open and close range of the previous price bar.
The close of the current price bar must be above the close of the prior price bar.
Requirements for a TD Clopwin Sell short entry:
The open and close of the current price bar must be contained within the open and close range of the previous price bar.
The close of the current price bar must be below the close of the prior price bar.
The code 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("TD Clopwin", overlay = true)
lookback = input(defval = 13, title = 'Lookback')
buy = close > math.min(close[1], open[1]) and close < math.max(close[1], open[1]) and open > math.min(close[1], open[1]) and open < math.max(close[1], open[1]) and close > close[2]
sell = close > math.min(close[1], open[1]) and close < math.max(close[1], open[1]) and open > math.min(close[1], open[1]) and open < math.max(close[1], open[1]) and close < close[2]
plotshape(buy, style = shape.triangleup, color = color.blue, location = location.belowbar, size = size.small)
plotshape(sell, style = shape.triangledown, color = color.orange, location = location.abovebar, size = size.small)