Join waitlist
Strategies / Breakout / Pivot Contraction Box Breakout

Pivot Contraction Box Breakout

The strategy goes long when price breaks above a contraction box formed by narrowing pivots, and sells short when price breaks below it. The position is a stop-and-reverse with a stop at a SuperTrend level.

BreakoutLong & shortIntradayGold30 min
n/aProfit factor
925Net profit EUR
23.68%Win rate
1,043Trades
-909Max drawdown
0.89Avg trade

Best run of 9. Gold, 30 min, spread 0.6, from run sweeps:2026-10-07-GOLD-30m-opt.tsv:29.

Entry rules, long

  1. Pivots use 12 bars on each side, and the latest pivot high is lower than the previous one while the latest pivot low is higher.
  2. The SuperTrend(3,10) level is below the close, and the stop is set at its distance from the fill.

Entry rules, short

  1. The low from 12 bars ago is below the bottom of the box.

Exit rules

  1. An opposite signal closes the trade and reverses it.

Test conditions

PeriodUp to 2026-10-07
InstrumentGold, 30 minutes
Spread0.6 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-10-10

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run30 minn/a 1,04323.68925 EUR-909
USD/JPYDailyn/a 711.41239,660 USD-222,570
Nikkei 225Dailyn/a 5127.4537,580 USD-7,762
Dow Jones30 minn/a 37023.519,504 EUR-4,788
Nasdaq 10015 minn/a 97220.788,653 EUR-3,362
Nasdaq 1004 hoursn/a 13317.296,209 EUR-3,846
Gold1 hourn/a 70022.291,366 EUR-569
S&P 50030 minn/a 82923.881,235 EUR-1,024
S&P 5004 hoursn/a 12122.31937 EUR-595

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Pivot Contraction Box Breakout
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Breakout
// Direction: Long & short
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE ub = 0
ONCE lb = 0
ONCE dir = 1
ONCE st = 0
ONCE phy = 0
ONCE ply = 0
ONCE pht = 0
ONCE plt = 0
ONCE top = 0
ONCE btm = 0
ONCE havetb = 0

len = 12

myAtr = AverageTrueRange[10](close)
upper = MedianPrice + 3.0 * myAtr
lower = MedianPrice - 3.0 * myAtr

97 more lines: the entry and exit rules.

Setup

How to load it

  1. Copy the code with the copy button on 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.

Indicators used

ATRSuperTrend
Read this firstKnown weaknesses2 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 909 EUR is large next to the net profit of 924 EUR.

Questions

About this strategy

Can I run Pivot Contraction Box Breakout in ProOrder?

Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.

Which markets was it tested on?

It was tested on 9 market and timeframe combinations. The best run by trade count was Gold, 30 minutes, with 1,043 trades.

How large was the drawdown?

The best run had a maximum drawdown of 909 EUR at the tested position size, against a net result of 924 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

KDJ J Line Momentum Long

Uses the same indicator.

4.17 PF · 6,135 trades

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

Big Candle Breakout

Also a breakout strategy.

n/a PF · 4,636 trades

Want strategies that are already part of a live portfolio? 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