Presenting and Back-testing the 2-1-2 Candlestick Pattern
Back-testing the 2-1-2 Pattern in the Strat Price Action Technique
Candlestick patterns are an amazing pattern recognition tool that needs to be studied more. This article discusses the 2-1-2 pattern that is applied using the Strat indicator, a technique discussed in a previous article.
Knowledge must be accessible to everyone. This is why, from now on, a purchase of either one of my new books “Contrarian Trading Strategies in Python” or “Trend Following Strategies in Python” comes with free PDF copies of my first three books (Therefore, purchasing one of the new books gets you 4 books in total). The two new books listed above feature a lot of advanced indicators and strategies with a GitHub page. You can use the below link to purchase one of the two books (Please specify which one and make sure to include your e-mail in the note).
Pay Kaabar using PayPal.Me
Go to paypal.me/sofienkaabar and type in the amount. Since it’s PayPal, it’s easy and secure. Don’t have a PayPal…www.paypal.com
Refresher on the Strat Indicator
Candlestick charts are among the most famous ways to analyze the time series visually. They contain more information than a simple line chart and have more visual interpretability than bar charts.
A candlestick is a box-shaped chronological element composed of OHLC data which helps determining the trend but also gives more information on volatility and market psychology.
A bullish candlestick is generally green (or white) and occurs whenever the close price is higher than the open price.
A bearish candlestick is generally red (or black) and occurs whenever the close price is lower than the open price.
The next chart shows a candlestick chart on EURUSD. The time frame used is hourly. What can you say about the trend seen?
The Strat indicator is an overlay technique which means that its information (or values) appear on the same chart as the candlesticks as opposed to independent indicators that are charted in a different panel (e.g. the RSI).
Created by Rob Smith, the Strat indicator aims to categorize candlesticks based on their position relative to the previous ones.
Inside bar (labeled as 1): The candle is completely within the high and low of the previous candle. An inside bar represents indecision.
Directional bar (labeled as 2): The candle extends above or below either the high or low of the previous candle.
Outside bar (labeled as 3): The candle extends both above and below either the high or low of the previous candle.
The color of the candles are not extremely important in the Strat indicator. The following Figure shows a theoretical illustration of an inside bar.
The following Figure shows a theoretical illustration of a directional bar.
The following Figure shows a theoretical illustration of an outside bar.
Inside bars may represent a pause in the current move and may signal a reversal or a consolidation. Directional bars represent a continuation of the move (the market is still in the middle of the established trend). Outside bars represent a possibility of a broadening formation.
Check out my weekly market sentiment report to understand the current positioning and to estimate the future direction of several major markets through complex and simple models working side by side. Find out more about the report through this link that covers the analysis between 07/08/2022 and 14/08/2022:
Coalescence Report 7th August — 14th August 2022
THIS IS A FREE SAMPLE GIVEN TO FREE SUBSCRIBERS THIS WEEK. IF YOU WANT TO REGULARLY HAVE THIS REPORT, MAKE SURE TO…coalescence.substack.com
The 2-1-2 Pattern
If you have read my previous articles (or books), then you should have an idea on how to import and manipulate financial time series in Python. To make this section short, I will only show the signal function which is the function that contains the necessary conditions that reflect the needed pattern. Just keep in mind the following variables:
Now, the 2-1-2 is a continuation candlestick pattern that comes from using the Strat technique. The theoretical illustrations are as shown below.
Therefore, the trading conditions are as follows:
A bullish 2–1–2 continuation pattern is validated when a directional up candle is printed and followed by an inside candle. The bullish signal is given when a new candle surpasses the high of the inside candle and the target is set to the high of the directional candle.
A bearish 2–1–2 continuation pattern is validated when a directional down candle is printed and followed by an inside candle. The bearish signal is given when a new candle breaks the low of the inside candle and the target is set to the low of the directional candle.
The signal function in Python can be coded as follows (keep in mind the variables used to help guide you):
Obviously the trades are short since the target is close to the entry (this should say something about the hit ratio already). The next Figure shows a signal chart on EURUSD.
The next Figure shows a signal chart on USDCHF.
Since no stop limit is given, I will assume a time limit for the position to be exited, that is if we initiate a position, it should not be longer than 10 time periods before closing at the close price of the candle. This is of course risky but it better than not having a stop at all.
Let’s take a look at the back-testing results on EURUSD’s hourly values since 2012:
Hit Ratio = 90.10%
Profit factor = 1.05
Realized RR = 0.115
Number of Trades = 3255
Take a look at the below equity curve.
It seems that the strategy has a very high hit ratio but with such a low risk-reward ratio, it is unlikely to give any profits due to the return volatility and the huge risk. The number of trades is healthy but the strategy in its default parameter does not work.
Remember this when FX signal providers promise you a 90% accuracy.
To sum up, what I am trying to do is to simply contribute to the world of objective technical analysis which is promoting more transparent techniques and strategies that need to be back-tested before being implemented. This way, technical analysis will get rid of the bad reputation of being subjective and scientifically unfounded.
I recommend you always follow the the below steps whenever you come across a trading technique or strategy:
Have a critical mindset and get rid of any emotions.
Back-test it using real life simulation and conditions.
If you find potential, try optimizing it and running a forward test.
Always include transaction costs and any slippage simulation in your tests.
Always include risk management and position sizing in your tests.
Finally, even after making sure of the above, stay careful and monitor the strategy because market dynamics may shift and make the strategy unprofitable.