If you’re a trend follower like me, the word ‘breakout’ is music to your ears.
An explosive breakout could signal the start of a major price trend.
If you trade manually, chart patterns like flags and triangles are often good predictors of upcoming breakouts.
Discerning chart patterns using a trading algorithm is rather challenging. Fortunately, we can circumvent this by using StrategyQuant’s support & resistance ranking (SR%) indicator.
What’s the Support & Resistance Ranking Indicator?
The SR% indicator is not available in MT4 by default; you can download it here.
The SR% calculates the percentage of time the current close falls within the high-low range of each candle in the lookback period.
Here’s a couple of examples to illustrate how it’s calculated. Let’s use a 5-bar lookback period for clarity.
The large bullish candle shows a breakout from a period of consolidation. This candle has a SR% of 0%, because its close lies outside the high-low range of all 5 candles in the lookback period.
At the other end of the spectrum, here we have a small candle that’s caught within a range. Its closing price is within the high-low range of all 5 candles before it, so its SR% is 100%.
Using the Support & Resistance Indicator With Breakouts
You want to look for a series of low SR% values.
If the SR% falls sharply, it likely indicates a breakout has occurred. Here’s an example with a 50-period SR%.
If the SR% falls gradually, prices have been closing near the boundaries of the current trading range. This increase in buying/selling pressure means a breakout could be imminent.
Ideally, you want to see these low SR% values after a long period of consolidation. These are often followed by explosive breakouts.
Programming a Breakout Strategy
Now that we know what to look out for, it’s time to convert our idea into an algorithm.
To exploit the increased buying/selling pressure, I will enter the market when the SR% ≤ 3% for the three most recent closes.
This can be programmed very easily in AlgoWizard:
- Basic Mode: The SR% will use the bar highs and lows to determine the trading range, as illustrated above. The alternative, ATR Mode, adds an ATR buffer to the trading range. The (high + ATR) and (low – ATR) for each bar are used for the upper and lower boundaries, respectively. This ATR mode gives a delayed but more reliable breakout signal.
- LookbackPeriod: The number of bars used to construct the trading range. I’ll use 80.
- ATRPeriod: ATR lookback period if you use the ATR mode. Not relevant in this case.
- Bar shift [1]: A shift of 1 refers to the most recently completed bar. [2] refers to the bar before that, and so on. All three conditions are identical except for the bar shift.
- Threshold: Percentage of time the current close falls within the trading range. I’ll use 3% here. For an 80-bar lookback, this means a maximum of 2 closes within the range.
Note that entry conditions are identical on the long and short sides.
This strategy actually reminds me of the classic Donchian channel breakout, where you go long when price closes above the highest high over the lookback period.
The Turtles used Donchian breakouts to great success in the 1980s.
A key difference is that the Donchian breakout condition only involves the most recent bar, whereas I’m looking at the three most recent bars here.
This should help focus on breakouts that are sustainable, instead of ‘fakeouts’ that quickly revert to the consolidation range.
The Support & Resistance + CCI Combo
I often use two or more conceptually distinct indicators when programming entry signals.
Awaiting confluence from two or more indicator types generally improves signal reliability.
Since the SR% indicator uses price action, I’ll pair it with a seriously underrated momentum indicator: the Commodity Channel Index (CCI).
The CCI measures the current price relative to an average price over a given lookback period. I’ll use a lookback period of 80, similar to that of the SR%.
I consider the market bullish when the CCI exceeds 100, and bearish when the CCI falls below -100.
Long entries will have an additional CCI > 100 condition, while short entries will need CCI < -100.
Time-Based Entry Filters and Exits
The periodic fluctuations in trading volume tend to have a large impact on short-term strategies.
Since this breakout strategy trades on the 15-minute timeframe, I’ll only enter the market when trading volumes are high.
The London open – New York midday window is usually when volumes are highest. A time filter was configured in AlgoWizard to only allow entries within this window. Don’t forget to use your broker’s time zone!
Lastly, since short-term strategies are most vulnerable to weekend gaps, I’ll prevent entries on Friday, and close all existing trades at Friday 3pm New York time.
Using Stop Entries for Confirmation
I like to use stop entries for breakout strategies, where some price confirmation is needed before I enter the market.
The entry price is marginally worse, but the improvement in reliability is usually worth it.
For this strategy, buy stops will be placed at 1 ATR above the previous high. Sell stops will be placed 1 ATR below the previous low. Each stop entry will be valid for 3 bars.
With all the rules in place, here’s an example of a long entry.
Backtesting the Support & Resistance Strategy
At last, here’s the 10-year backtest on the USDJPY.
There are long periods of stagnation within the first 5 years. Can the strategy be improved?
I had a detailed look at the equity curve and toggled the overlays for maximum favourable excursion (MFE) and maximum adverse excursion (MAE).
The MFE is the trade’s maximum open profit over the duration of the trade, while the MAE is the maximum open loss.
Looking at the MFE plot above, there were numerous occasions where the strategy lost a large chunk of open profits. Perhaps there was a sharp trend reversal after an undesirable economic report.
Adding a profit target is a good way to minimize open profit giveback. Since this is a trend following strategy, I know I’ll need the occasional outsized win to make up for the relatively low win rate (
