Join today
Strategies / Breakout / Resistance Breacher

Resistance Breacher: Trading Breaks of Confirmed Swings

Resistance Breacher buys when price closes above the last confirmed swing high made while above the 47 SMA and 53 EMA, with Stochastic(8,3) above 45 and a gently rising 8 EMA. Shorts use the mirror image. Stops and targets are multiples of ATR(10), and every trade closes on the first bar of a new day.

BreakoutLong & shortSwingBrent Crude4 hours
1.58Profit factor
4,630Net profit EUR
60.56%Win rate
142Trades
-1,654Max drawdown
32.61Avg trade

Best run of 4. Brent Crude, 4 hours, spread 3, from run pf:2026-09-15-BRENT-4h.tsv:3.

Entry rules, long

  1. Not a Monday
  2. Stochastic(8,3) is above 45
  3. The 8-period EMA rose by between 0.02% and 0.05% on this bar
  4. Members only
  5. A new swing has formed since the last trade
  6. 3.5 x ATR(10) is larger than 20

Entry rules, short

  1. Stochastic(8,3) is below 65
  2. The 8-period EMA fell by between 0.02% and 0.05% on this bar
  3. Close is below the last confirmed swing low (a bounce low made while price is below both the 47 SMA and the 53 EMA); this level resets to zero whenever price closes above either average, and then the test never passes
  4. Members only
  5. 6.5 x ATR(10) is larger than 20

Exit rules

  1. Members only
  2. Short stop at 6.5 x ATR(10), target at 3.5 x ATR(10)
  3. Close any open trade on the first bar of a new day

Test conditions

PeriodUp to 2026-09-15
InstrumentBrent Crude, 4 hours
Spread3 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-09-16

Parameters

baseSize
Lots after a winning trade
2
afterLossSize
Lots after one or two losing trades
3
afterThreeLossesSize
Lots after three losing trades in a row
2
afterTwoWinsSize
Lots after two winning trades in a row
1
afterSixLossesSize
Lots after six losing trades in a row
5
afterSixWinsSize
Lots after six winning trades in a row
1
stochPeriod
Stochastic length
8
stochSmooth
Stochastic smoothing
3
slopePeriod
EMA used to measure the short-term slope
8
longStochLevel
Longs need the stochastic above this
45
shortStochLevel
Shorts need the stochastic below this
65
minSlope
Minimum bar-to-bar EMA change ratio
1.0002
maxSlope
Maximum bar-to-bar EMA change ratio
1.0005
smaPeriod
Simple average used for swing tracking
47
emaPeriod
Exponential average used for swing tracking
53
atrPeriod
ATR length for stop and target
10
longStopAtr
Long stop in ATR multiples
3.5
longTargetAtr
Long target in ATR multiples
12
shortStopAtr
Short stop in ATR multiples
6.5
shortTargetAtr
Short target in ATR multiples
3.5
minStopDistance
Skip trades whose stop would be smaller than this
20
skipLongDay
Longs only on weekdays after this number (skips Monday)
1

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
Brent CrudeBest run4 hours1.58 14260.564,630 EUR-1,654
Gold1 min1.16 63560.791,827 EUR-653
Dow Jones1 hour1.09 97748.9316,253 EUR-13,477
Nikkei 2251 min1.05 1,34646.5120,011 USD-17,262

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.00.51.01.52.01.0 = break-evenBrent Crude · 4 hours1.58Gold · 1 min1.16Dow Jones · 1 hour1.09Nikkei 225 · 1 min1.05

Net profit against max drawdown

Net profitMax drawdown
0-20K-10K13K25KNikkei 225 · 1 minDow Jones · 1 hourBrent Crude · 4 hoursGold · 1 min

Longer history

Re-run on up to 1,000,000 bars

Gold 1 minute had the full 1,000,000 bars, and profit shrank to EUR 553.40 from EUR 1,826.70 in the standard run because the older data alone lost EUR 1,273.30.

Gold · 1 min

Bars available1,000,000
Net, standard 200,000-bar run1,826.70 EUR
Net, long run553.40 EUR
Net on the older data alone-1,273.30 EUR

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Resistance Breacher
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Breakout
// Direction: Long & short
// Timeframe tested: 4 hours
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false
DEFPARAM PreloadBars = 1000

// --- Parameters ---
baseSize = 2                 // lots after a winning trade
afterLossSize = 3            // lots after one or two losing trades
afterThreeLossesSize = 2     // lots after three losing trades in a row
afterTwoWinsSize = 1         // lots after two winning trades in a row
afterSixLossesSize = 5       // lots after six losing trades in a row
afterSixWinsSize = 1         // lots after six winning trades in a row
stochPeriod = 8              // stochastic length
stochSmooth = 3              // stochastic smoothing
slopePeriod = 8              // EMA used to measure short-term slope
longStochLevel = 45          // longs need the stochastic above this
shortStochLevel = 65         // shorts need the stochastic below this
minSlope = 1.0002            // EMA must move at least this ratio bar to bar
maxSlope = 1.0005            // and less than this ratio, so the move is not stretched
smaPeriod = 47               // simple average for swing tracking
emaPeriod = 53               // exponential average for swing tracking
atrPeriod = 10               // ATR length for stop and target
longStopAtr = 3.5            // long stop in ATR multiples
longTargetAtr = 12           // long target in ATR multiples
shortStopAtr = 6.5           // short stop in ATR multiples
shortTargetAtr = 3.5         // short target in ATR multiples
minStopDistance = 20         // skip trades whose stop would be smaller than this
skipLongDay = 1              // longs only after this weekday number (skips Monday)

// Swing state carried from bar to bar
ONCE setupReady = 0
ONCE swingLow = 0
ONCE confirmedLow = 0
ONCE swingHigh = 0
ONCE confirmedHigh = 0
ONCE stopDistance = 0
ONCE targetDistance = 0

// --- Indicators ---
stochK = Stochastic[stochPeriod, stochSmooth](close)
slopeMA = ExponentialAverage[slopePeriod](close)
smaFilter = Average[smaPeriod](close)
emaFilter = ExponentialAverage[emaPeriod](close)
atrValue = AverageTrueRange[atrPeriod]

// Size up after losses and down after wins.
positionSize = baseSize
IF PositionPerf(1) < 0 THEN
  positionSize = afterLossSize
ENDIF
IF PositionPerf(1) < 0 AND PositionPerf(2) < 0 AND PositionPerf(3) < 0 THEN
  positionSize = afterThreeLossesSize
ENDIF
IF PositionPerf(1) > 0 AND PositionPerf(2) > 0 THEN
  positionSize = afterTwoWinsSize
ENDIF
IF PositionPerf(1) < 0 AND PositionPerf(2) < 0 AND PositionPerf(3) < 0 AND PositionPerf(4) < 0 AND PositionPerf(5) < 0 AND PositionPerf(6) < 0 THEN
  positionSize = afterSixLossesSize
ENDIF
IF PositionPerf(1) > 0 AND PositionPerf(2) > 0 AND PositionPerf(3) > 0 AND PositionPerf(4) > 0 AND PositionPerf(5) > 0 AND PositionPerf(6) > 0 THEN
  positionSize = afterSixWinsSize
ENDIF

61 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Position size changes with the recent streak, from 1 to 5 lots, including adding size after losses. That can make drawdowns grow quickly.
  • The headline Brent Crude 4 hour run has only 142 trades.
  • Only 4 runs exist, and Nikkei 225 1 minute had a profit factor of 1.05 with a 17,261.50 USD drawdown.
  • When price closes below either average, the swing high level resets to zero and the long breakout test always passes.

Indicators used

StochasticEMASMAATR

How to load it

  1. Copy the code with the copy button above the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Questions

About this strategy

Is it ready for ProOrder?

Yes, it runs automatically including the streak-based sizing. Review the lot sizes (base 2, up to 5) against your account before going live.

How did it do on each market?

Brent Crude 4 hours made 4,630.30 EUR with a profit factor of 1.58. Gold 1 minute, Dow Jones 1 hour and Nikkei 225 1 minute were positive but with profit factors between 1.05 and 1.16.

What drawdown should I plan for?

Brent Crude 4 hours had a max drawdown of 1,654.40 EUR with sizes between 1 and 5 lots and a 3 point spread. Dow Jones 1 hour reached 13,476.80 EUR.

Why the 4 hour chart?

Swing highs on 4 hour bars mark levels that other traders watch, and the ATR(10) stops are wide enough to avoid noise. That chart gave the best profit factor, 1.58.

Related

Strategies like this one

Monday Dip Buy

Uses the same indicator.

n/a PF · 146 trades

Morning Range Breakout

Best run on the same market, Brent Crude.

1.89 PF · 434 trades

Double Sevens

A similar profit factor.

1.58 PF · 743 trades

See how members handle position sizing. Join the ProRealAlgos waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs