Tested by BacktestingMax
Support and resistance breakout strategy backtest
Do support and resistance breakouts make money?
Mostly no. The breakout strategy buys when a candle closes above a resistance zone, and sells when a candle closes below a support zone. A zone is a price area where price turned at least twice before. We ran 30 backtests from 2014 to 2025, after trading costs: 6 currency pairs, gold and 3 stock indices, each on 1-hour, 4-hour and daily charts. With the basic rules, the strategy lost money on all 10 markets on 1-hour charts, and made money in 10 of the 20 tests on 4-hour and daily charts. To check the newer years on their own, we split the test in two: 5 tests made money in both 2014–2021 and 2022–2025. Of 3 common changes, trading only zones where price had turned 3 or more times helped most: 11 of the 20 tests on 1-hour and 4-hour charts made money with it, compared with 5 with the basic rules. On daily charts, this rule left too few trades to judge.
30 backtests 2014–2025 Trading costs included Tested 12 October 2026
Where it worked 30 backtests- Made money
- 10 of 30 tests, with the basic rules
- Made money in both periods
- 5 2014–2021 and again 2022–2025
- Best backtest
- +93% GBP/JPY, 4-hour chart: account growth 2014–2025
- Only zones with 3 or more touches
- 7 tests made money in both periods, compared with 5 with the basic rules
Made money in both periods
- GBP/USD, 4-hour
- USD/JPY, daily
- GBP/JPY, 4-hour
- Gold, daily
- Nasdaq 100, daily
Lost money on every market
- 1-hour charts
The results
Results on every market
Each box shows one backtest of the support and resistance breakout with the basic rules, from 2014 to 2025, after trading costs: the % result, and a small chart of the account balance. The solid line is the account balance and the dashed line is the starting balance. Green results made money; red results lost money. Under each result: whether it made money in both 2014–2021 and 2022–2025, or passed all four of our checks (see "How a test passes" further down).
| Market | 1-hour | 4-hour | daily |
|---|---|---|---|
| EUR/USD | −81% Lost money | −13% Lost money | −2% Lost money |
| GBP/USD | −68% Lost money | +22% Made money in both periods | −3% Lost money |
| USD/JPY | −39% Lost money | −33% Lost money | +13% Passed all four checks |
| AUD/USD | −93% Lost money. Account down 90% by Mar 2025 | −41% Lost money | −22% Lost money |
| USD/CAD | −97% Lost money. Account down 90% by Feb 2023 | −36% Lost money | −9% Lost money |
| GBP/JPY | −18% Lost money | +93% Made money in both periods | −0.5% Lost money |
| Gold | −33% Lost money | +11% Made money overall, lost in one period | +31% Passed all four checks |
| S&P 500 | −84% Lost money | +42% Made money overall, lost in one period | +9% Made money overall, lost in one period |
| Nasdaq 100 | −73% Lost money | −22% Lost money | +15% Passed all four checks |
| DAX | −75% Lost money | +7% Made money overall, lost in one period | +2% Made money overall, lost in one period |
All the numbers, test by test
| Market | Chart | Trades | Win rate | Profit factor | Result | Max drawdown | 2014–2021 | 2022–2025 | Monte Carlo drawdown | Trading costs |
|---|---|---|---|---|---|---|---|---|---|---|
| EUR/USD | 1-hour | 2,721 | 32.9% | 0.93 | −81.1% | −84.0% | −49.2% | −62.8% | −89.1% | $6,095 |
| EUR/USD | 4-hour | 777 | 33.7% | 0.97 | −13.1% | −22.6% | −9.5% | −3.9% | −49.8% | $1,189 |
| EUR/USD | daily | 131 | 33.6% | 0.98 | −1.7% | −16.0% | −1.7% | 0.0% | −21.9% | $84 |
| GBP/USD | 1-hour | 2,770 | 33.6% | 0.95 | −68.2% | −72.3% | −40.6% | −46.5% | −84.7% | $7,267 |
| GBP/USD | 4-hour | 761 | 35.1% | 1.04 | +22.3% | −33.3% | +4.7% | +16.8% | −40.9% | $1,616 |
| GBP/USD | daily | 120 | 32.5% | 0.95 | −3.2% | −16.3% | −5.2% | +2.1% | −20.8% | $77 |
| USD/JPY | 1-hour | 2,836 | 34.3% | 0.97 | −39.2% | −56.3% | −34.4% | −7.2% | −76.9% | $7,362 |
| USD/JPY | 4-hour | 706 | 32.4% | 0.91 | −33.0% | −49.2% | −46.7% | +25.7% | −56.0% | $975 |
| USD/JPY | daily | 112 | 37.5% | 1.19 | +12.9% | −8.5% | +6.9% | +5.6% | −16.4% | $74 |
| AUD/USD | 1-hour | 3,018 | 32.3% | 0.87 | −93.2% | −93.5% | −76.8% | −70.5% | −95.5% | $4,702 |
| AUD/USD | 4-hour | 793 | 32.2% | 0.90 | −40.9% | −47.0% | −26.7% | −19.3% | −60.1% | $1,371 |
| AUD/USD | daily | 149 | 28.2% | 0.76 | −22.1% | −24.3% | −11.2% | −12.2% | −33.0% | $129 |
| USD/CAD | 1-hour | 2,937 | 31.3% | 0.90 | −96.9% | −97.6% | −82.2% | −82.7% | −97.8% | $6,766 |
| USD/CAD | 4-hour | 758 | 32.5% | 0.92 | −36.2% | −56.8% | −11.9% | −27.6% | −58.4% | $1,760 |
| USD/CAD | daily | 131 | 32.1% | 0.89 | −9.4% | −26.3% | −1.5% | −8.0% | −25.2% | $124 |
| GBP/JPY | 1-hour | 2,816 | 35.4% | 0.99 | −17.9% | −43.5% | +0.5% | −18.3% | −73.5% | $16,065 |
| GBP/JPY | 4-hour | 723 | 37.8% | 1.18 | +92.9% | −22.5% | +1.6% | +89.8% | −32.2% | $2,178 |
| GBP/JPY | daily | 113 | 33.6% | 0.99 | −0.5% | −16.0% | +10.1% | −9.6% | −20.0% | $114 |
| Gold | 1-hour | 2,655 | 35% | 0.98 | −32.6% | −56.7% | −3.6% | −30.1% | −74.9% | $15,274 |
| Gold | 4-hour | 759 | 34.8% | 1.02 | +11.3% | −40.4% | −2.9% | +14.6% | −42.2% | $2,081 |
| Gold | daily | 107 | 43% | 1.52 | +30.6% | −12.7% | +7.5% | +21.5% | −11.8% | $97 |
| S&P 500 | 1-hour | 2,751 | 32.7% | 0.85 | −84.1% | −88.0% | −82.8% | −7.5% | −90.6% | $4,095 |
| S&P 500 | 4-hour | 825 | 36% | 1.09 | +41.7% | −51.1% | −11.2% | +59.6% | −41.7% | $1,362 |
| S&P 500 | daily | 119 | 37% | 1.13 | +9.1% | −15.9% | −1.2% | +10.4% | −18.0% | $88 |
| Nasdaq 100 | 1-hour | 2,763 | 33.6% | 0.88 | −72.9% | −87.2% | −79.5% | +32.5% | −85.1% | $5,792 |
| Nasdaq 100 | 4-hour | 826 | 33.3% | 0.95 | −21.7% | −47.1% | −17.9% | −4.6% | −52.6% | $1,786 |
| Nasdaq 100 | daily | 141 | 37.6% | 1.20 | +14.9% | −8.4% | +1.3% | +13.5% | −16.3% | $109 |
| DAX | 1-hour | 2,729 | 32.1% | 0.89 | −75.2% | −81.2% | −75.4% | +0.6% | −85.8% | $1,893 |
| DAX | 4-hour | 784 | 33.4% | 1.01 | +6.5% | −27.4% | +20.1% | −11.3% | −43.2% | $724 |
| DAX | daily | 131 | 34.4% | 1.03 | +1.9% | −18.4% | −11.3% | +14.8% | −18.8% | $36 |
Profit factor is the money won divided by the money lost. Above 1 means the test made money. Max drawdown is the biggest fall from the highest balance. 2014–2021 and 2022–2025 show the result in each period on its own. Monte Carlo drawdown: we shuffled the trades into a random order 1,000 times; in 95% of those runs, the worst drawdown was this number or less. Result is the change in the account, with the risk of each trade set to 1% of the account at that time.
The account balance
The best test and the middle test
What we found
What the 30 backtests show
On 1-hour charts, the breakout strategy lost money on all 10 markets. On AUD/USD and USD/CAD, the account lost more than 90% of its starting balance. In 6 of the 10 tests, the trades lost money even before trading costs.
On 4-hour and daily charts, the breakout strategy made money in 10 of 20 tests. 5 of them made money in both 2014–2021 and 2022–2025: GBP/USD and GBP/JPY on 4-hour charts, and USD/JPY, gold and the Nasdaq 100 on daily charts. The best backtest was GBP/JPY on 4-hour charts: the account grew 92.9% from 2014 to 2025, and at one point it was 22.5% below its highest balance. The 3 daily tests that made money in both periods also passed all four of our checks, but with few trades and small gains: 107 to 141 trades in 12 years, and account growth of 12.9% to 30.6%.
About 1 trade in 3 reached its take-profit (the profit target): 33.5% of all 36,962 trades. The other 2 in 3 hit the stop-loss first. The take-profit is 2 times the risk, so 1 winning trade pays for 2 losing ones. That means winning 1 trade in 3 only breaks even before trading costs. In the 30 tests, the win rate (the share of trades that won) ranged from 28.2% (AUD/USD, daily) to 43.0% (gold, daily).
Breakouts of zones with more touches did better. A touch is one time price turned at a zone. R is the amount a trade risks: 1% of the account. With the basic rules, every 100 trades on zones with 2 touches lost 5.9R on average, and every 100 trades on zones with 4 or more touches made 0.4R, after trading costs (see the chart below). Trading only zones with 3 or more touches was also the best of the 3 changes we tried.
Waiting for a retest did not help. A retest is when price comes back to the zone after a breakout. In this change, we waited up to 10 candles for price to come back to the zone and close beyond it again, and only then opened the trade. It made 24,520 trades instead of 36,962, and the same share of trades won: 33.5%. With it, 2 tests made money in both periods, compared with 5 with the basic rules.
Touches
Breakouts of zones with more touches did better
This chart groups all 36,962 trades of the basic rules in the 30 tests, from 2014 to 2025, by the number of touches of the zone that price broke. Each bar shows the average result per 100 trades, in R, after trading costs. R is the amount a trade risks: 1% of the account. −5.9R means that every 100 trades lost 5.9 times the amount risked on one trade.
- 2 touches18,146 trades, 32.5% won −5.9R
- 3 touches8,410 trades, 34.2% won −1.2R
- 4 or more touches10,406 trades, 34.7% won +0.4R
More touches did better in both 2014–2021 and 2022–2025, on the currency pairs and on the stock indices. Daily charts were the exception: on the 1,254 daily trades, breakouts of zones with 2 touches did best.
By chart
Which change helped on which chart
The number of tests that made money from 2014 to 2025, after trading costs, out of the 10 markets on each chart. Each column is one version of the strategy: the basic rules, and the 3 changes described under 'Can the support and resistance breakout be improved?' below.
| Chart | Basic rules | Wait for a retest | Only 3 or more touches | Only high volume |
|---|---|---|---|---|
| 1-hour | 0 of 10 | 2 of 10 | 4 of 10 | 1 of 10 |
| 4-hour | 5 of 10 | 4 of 10 | 7 of 10 | 7 of 10 |
| Daily | 5 of 10 | 3 of 10 | 5 of 10 | 5 of 10 |
On daily charts, each of the 3 changes left only 63 to 96 trades per test in 12 years. That is fewer than the 100 trades we need to judge a test, so the daily results of the changes are not reliable.
The strategy
What the support and resistance breakout is
Support is a price level where falling prices stopped and turned up before. Resistance is a level where rising prices stopped and turned down. Price rarely turns at exactly the same price twice, so traders draw these levels as zones: narrow bands of prices. A breakout is a candle that closes beyond a zone. A common way to trade it: buy when a candle closes above resistance, and sell short (sell first, to profit if price falls) when a candle closes below support. The idea is that once price gets through a level that held before, it often keeps going. Each time price turned at a zone is called a touch, and many traders trust a zone more when it has more touches.
- Pivots
- A high above, or a low below, the 3 candles on each side
- Zones
- 2 or more pivots from the last 100 candles, each less than 0.5 ATR from the next, plus 0.25 ATR above and below. ATR(14) is how far price moves in an average candle, over the last 14 candles.
- Stop-loss
- 1 ATR below the top of the zone for a buy, 1 ATR above the bottom of the zone for a sell
- Take-profit
- 2R: twice the distance from the breakout candle's close to the stop-loss
- Risk per trade
- 1% of the account
The rules we tested
- Find the turning points. A pivot high is a candle whose high is higher than the highs of the 3 candles before it and the 3 candles after it. A pivot low is a candle whose low is lower than the lows of the 3 candles on each side. A pivot is only known 3 candles later, so the test only uses it from then on.
- Draw the zones. ATR is an indicator of how far price moves in an average candle, measured over the last 14 candles. A resistance zone is a group of 2 or more pivot highs from the last 100 candles at about the same price: sorted by price, each one is less than half an ATR from the next. The zone runs from 0.25 ATR below the lowest of these pivot highs to 0.25 ATR above the highest. A support zone is made the same way from pivot lows. Each pivot in a zone counts as one touch. The zones are drawn again at every candle, with that candle's ATR.
- Buy when a candle closes above the top of a resistance zone and the candle before it closed at or below that top. Sell (go short) when a candle closes below the bottom of a support zone and the candle before it closed at or above that bottom. The trade opens at the next candle's open.
- Put the stop-loss 1 ATR below the top of the zone for a buy, and 1 ATR above the bottom of the zone for a sell. If one candle closes past more than one zone, use the zone nearest to the close.
- Take profit at 2R. R is the risk of the trade: the distance from the breakout candle's close to the stop-loss. So the take-profit is twice that distance from the close, in the direction of the trade.
- Only one trade is open at a time. A breakout is skipped if a trade was still open during the breakout candle.
- Size every trade so that a loss at the stop-loss costs 1% of the account. The size uses the distance from the breakout candle's close to the stop-loss.
The method
How we tested it
The test
- Markets
- EUR/USD, GBP/USD, USD/JPY, AUD/USD, USD/CAD, GBP/JPY, Gold, S&P 500, Nasdaq 100 and DAX
- Charts
- 1-hour, 4-hour and daily candles
- Dates
- January 2014 to December 2025
- Account
- $10,000, risking 1% of the account on each trade
- Trading costs
- Included. Every trade pays that market's normal trading cost: the spread, which is the gap between the buy price and the sell price.
How a test passes
We call a test passed only if it meets all four checks. A strategy can make money in one backtest and still fail one of these checks.
- At least 100 trades. With fewer trades, a good result could be luck.
- It made money from 2014 to 2021 and again from 2022 to 2025. This shows whether the strategy kept working in the newer years, not only in the older ones.
- A profit factor (the money won divided by the money lost) of at least 1.2 from 2022 to 2025, after trading costs.
- In 95% of 1,000 random shuffles of the trades, the account must not fall more than 30% from its highest point.
Improvements
Can the support and resistance breakout be improved?
We tried three changes traders often make to support and resistance breakouts: waiting for price to come back and retest the zone, trading only zones with 3 or more touches, and trading only breakouts made on high volume. Volume is how much was traded during a candle. Each change ran on the same 30 tests. We picked the best change by the number of tests that made money in 2014–2021 only, then checked it on 2022–2025, the years we did not use to pick it. A change picked on the same years it is judged on almost always looks better than it is.
| Version | Made money 2014–2021years used to pick the best version | Made money 2022–2025years not used to pick it | Made money in both periods | Passed all four checks |
|---|---|---|---|---|
| The basic rules: trade the breakout candle The rules under 'The rules we tested', with nothing changed. | 8 of 30middle test −10.3% | 13 of 30middle test −4.2% | 5 | 3 |
| Wait for a retest of the zone A retest is when price comes back to the zone after a breakout. Don't trade the breakout candle. After a close above a resistance zone, wait up to 10 candles for a candle whose low comes back to the top of the zone and that closes above it again. Buy at the next candle's open. If a candle closes below the bottom of the zone first, skip the trade. The stop-loss stays 1 ATR below the top of the zone, and the take-profit is 2R from the close of the retest candle. For a sell, do the opposite. | 6 of 30middle test −16.8% | 11 of 30middle test −2.2% | 2 | 0 |
| Only zones with 3 or more touchesBest on 2014–2021 Only trade a zone made of 3 or more pivots: price turned at that level at least 3 times in the last 100 candles. The basic rules need 2. | 18 of 30middle test +1.1% | 16 of 30middle test +1.1% | 7 | 0 |
| Only breakouts on high volume Volume is how much was traded during a candle. Only take a breakout if the breakout candle had more volume than the average of the 20 candles before it. The volume comes from our price data: forex has no central exchange, and our gold and stock index prices are CFD prices (contracts that follow the market's price). So this is not the volume of the whole market. | 8 of 30middle test −5.2% | 16 of 30middle test +2.2% | 3 | 0 |
On 2014–2021, the years we used to pick, trading only zones with 3 or more touches did best: 18 of 30 tests made money with it, compared with 8 with the basic rules. On 2022–2025, the years we kept for the check, it still did better: 16 of 30 tests made money, compared with 13, and the middle test (half of the 30 did better, half did worse) was +1.1%, compared with −4.2%. 7 tests made money in both periods with it, compared with 5 with the basic rules. On daily charts, it left only 63 to 90 trades per test, too few to judge, so we do not count any daily test as making money in both periods. No test on any chart passed all four of our checks with this change; with the basic rules, 3 daily tests did. Waiting for a retest did worst on 2014–2021: 6 of 30 tests made money. Taking only breakouts on high volume made money in 8 of 30 tests on 2014–2021, the same as the basic rules. On 2022–2025 alone, it did as well as the 3-touch rule: 16 of 30 tests made money with it, and its middle test was +2.2%.
Questions
Questions traders ask
Does the support and resistance breakout strategy work?
Mostly no. In our backtest from 2014 to 2025, with trading costs, the basic rules made money in 10 of 30 tests (10 markets, each on 1-hour, 4-hour and daily charts), and all 10 of them were on 4-hour or daily charts. 5 of these 10 made money in both 2014–2021 and 2022–2025: GBP/USD and GBP/JPY on 4-hour charts, and USD/JPY, gold and the Nasdaq 100 on daily charts. About 1 trade in 3 reached its take-profit. With a take-profit at 2 times the risk, that is only enough to break even before trading costs.
Should you wait for a retest after a breakout?
Not in our test. A retest is when price comes back to the zone after a breakout. Waiting up to 10 candles for a retest that closes beyond the zone again made 24,520 trades instead of 36,962, and the same share of trades won as with the basic rules: 33.5%. It made money in 6 of 30 tests in 2014–2021, compared with 8 with the basic rules, which trade the breakout candle itself. 2 tests made money in both 2014–2021 and 2022–2025 with it, compared with 5 with the basic rules.
Does the number of touches matter for a breakout?
Yes, on 1-hour and 4-hour charts in our test. A touch is one time price turned at the zone. On those charts, breakouts of zones with 3 or more touches did better than breakouts of zones with 2 touches, in both 2014–2021 and 2022–2025. When we traded only zones with 3 or more touches, 11 of the 20 tests on 1-hour and 4-hour charts made money, compared with 5 with the basic rules. On daily charts, which had far fewer trades, breakouts of zones with 2 touches did best.
What is the best timeframe for support and resistance breakouts?
In our test, 4-hour and daily charts did better than 1-hour charts. On 1-hour charts, the basic rules lost money on all 10 markets, and in 6 of them the trades lost money even before trading costs. On 4-hour charts, 5 of 10 tests made money, and on daily charts 5 of 10 did too. But the daily tests made only 107 to 149 trades each in 12 years, so their gains were small: the best daily backtest was gold, where the account grew 30.6% from 2014 to 2025.
The strategy code we ran
This is the exact code from the BacktestingMax strategy engine. Paste it into the strategy editor in the app to run it on any market.
class SupportResistanceBreakout(Strategy):
"""Support and resistance breakout, as most traders learn it, plus three changes traders make.
Zones. A pivot high is a candle whose high is above the highs of the 3 candles before it
and the 3 candles after it, so it is known 3 candles later. A pivot low is the mirror image.
On every candle, take the pivot highs from the last 100 candles and sort them by price.
Pivot highs less than 0.5 ATR(14) apart belong to the same zone (each one within 0.5 ATR of
the next). A zone needs 2 or more of them, and it runs from 0.25 ATR below its lowest pivot
high to 0.25 ATR above its highest one: a band of 0.25 ATR either side of each pivot.
Support zones are made the same way from pivot lows.
Standard (all switches off): buy when a candle closes above the top of a resistance zone
and the candle before it closed at or below that top. Sell short when a candle closes below
the bottom of a support zone and the candle before it closed at or above that bottom. If one
candle breaks several zones, the zone nearest the close counts. The stop-loss goes 1 ATR
below the top of the zone for a buy, and 1 ATR above the bottom of the zone for a sell. The
take-profit is 2 times the risk (2R). Size so the stop costs 1% of the account. One trade at
a time: a breakout while a trade is open is ignored.
The changes, one at a time:
retest = 1 don't trade the breakout candle. Within the next 10 candles, buy the
first candle whose low comes back to the zone's top and that closes
above it (sells mirror this). A close beyond the far side of the zone
cancels the setup. Same stop (1 ATR below the zone's top), target 2R.
min_touches = 3 only trade zones made of 3 or more pivots
volume = 1 only trade a breakout candle with more volume than the average of the
20 candles before it
"""
params = {"pivot_bars": Param(type=int, default=3, min=1, max=20),
"zone_lookback": Param(type=int, default=100, min=20, max=1000),
"zone_atr": Param(type=float, default=0.25, min=0.05, max=2.0),
"stop_atr": Param(type=float, default=1.0, min=0.1, max=5.0),
"target_r": Param(type=float, default=2.0, min=0.5, max=10.0),
"min_touches": Param(type=int, default=2, min=2, max=10),
"retest": Param(type=int, default=0, min=0, max=1),
"retest_bars": Param(type=int, default=10, min=1, max=50),
"volume": Param(type=int, default=0, min=0, max=1)}
lookback = 10
def init(self, ctx):
n = ctx.params.pivot_bars
self.ph = ctx.pivot_high(source=ctx.high, left=n, right=n)
self.pl = ctx.pivot_low(source=ctx.low, left=n, right=n)
self.atr = ctx.atr(period=14)
self.avg_volume = ctx.rolling_mean(source=ctx.volume, period=20)
self.prev_avg_volume = None
self.highs = [] # (bar index, price) of each pivot high in the last 100 candles
self.lows = [] # the same for pivot lows
self.setup = None # retest version: (side, zone edge, far edge, last bar to enter)
def zones(self, pivots, half, min_touches):
"""Pivots less than 2 x half apart, merged into zones: (bottom, top, touches)."""
out = []
group = []
for price in sorted(x[1] for x in pivots):
if group and price - group[-1] >= 2 * half:
if len(group) >= min_touches:
out.append((group[0] - half, group[-1] + half, len(group)))
group = []
group.append(price)
if len(group) >= min_touches:
out.append((group[0] - half, group[-1] + half, len(group)))
return out
def enter(self, ctx, side, stop, tag):
entry = ctx.close[0]
rr = ctx.params.target_r
size = ctx.size_by_risk_pct(0.01, stop=stop, entry=entry)
if side > 0:
ctx.buy(size=size, sl=stop, tp=entry + rr * (entry - stop), tag=tag)
else:
ctx.sell(size=size, sl=stop, tp=entry - rr * (stop - entry), tag=tag)
def on_bar(self, ctx):
p = ctx.params
i = ctx.bar_index
# Read the pivots and the volume average on every candle, before any return.
hi, lo = self.ph.value, self.pl.value
if hi is not None:
self.highs.append((i - p.pivot_bars, hi))
if lo is not None:
self.lows.append((i - p.pivot_bars, lo))
oldest = i - p.zone_lookback
self.highs = [x for x in self.highs if x[0] > oldest]
self.lows = [x for x in self.lows if x[0] > oldest]
avg_before, self.prev_avg_volume = self.prev_avg_volume, self.avg_volume.value
a = self.atr.value
if a is None or a <= 0:
return
if ctx.position is not None:
self.setup = None
return
c0, c1 = ctx.close[0], ctx.close[1]
stop_dist = p.stop_atr * a
# Retest version: a breakout from an earlier candle waits for price to come back.
if self.setup is not None:
side, edge, far, last_bar = self.setup
if i > last_bar or (side > 0 and c0 < far) or (side < 0 and c0 > far):
self.setup = None # no retest in time, or price went back through the zone
elif side > 0 and ctx.low[0] <= edge < c0:
self.setup = None
self.enter(ctx, 1, edge - stop_dist, "retest_long")
return
elif side < 0 and ctx.high[0] >= edge > c0:
self.setup = None
self.enter(ctx, -1, edge + stop_dist, "retest_short")
return
half = p.zone_atr * a
up = [z for z in self.zones(self.highs, half, p.min_touches) if c1 <= z[1] < c0]
down = [z for z in self.zones(self.lows, half, p.min_touches) if c1 >= z[0] > c0]
if not ctx.gate("close_breaks_zone", len(up) > 0 or len(down) > 0):
return
loud = avg_before is not None and ctx.volume[0] > avg_before
if not ctx.gate("breakout_volume", p.volume == 0 or loud):
return
if len(up) > 0:
bottom, top, _ = max(up, key=lambda z: z[1])
if p.retest == 1:
self.setup = (1, top, bottom, i + p.retest_bars)
else:
self.enter(ctx, 1, top - stop_dist, "breakout_long")
else:
bottom, top, _ = min(down, key=lambda z: z[0])
if p.retest == 1:
self.setup = (-1, bottom, top, i + p.retest_bars)
else:
self.enter(ctx, -1, bottom + stop_dist, "breakout_short")
Your turn
Test the support and resistance breakout yourself
Change the settings, the market or the stop-loss and see the result in seconds. Ask the BacktestingMax AI: Backtest a support and resistance breakout on GBP/JPY, 4-hour chart, trading only zones with 3 or more touches
.
Free account. No credit card needed.
See every strategy we tested Browse strategies shared by tradersBacktest on historical data with trading costs, run by BacktestingMax. Past results do not guarantee future results, and nothing here is financial advice. Updated 12 October 2026.