Join today
Strategies / Breakout / Range Breakout And Fakeout

Range Breakout And Fakeout: Trading Both Sides of Yesterday's Range

Yesterday's high and low define a range, and the system places orders just outside it for breakouts and just inside it for fakeouts that fall back in. It only trades when that range is between 20 and 150 points and skips Fridays. Position size is risk based, at 0.5% of equity divided by the stop distance.

BreakoutLong & shortSwingDAX 404 hours
n/aProfit factor
2,477,210Net profit EUR
16.48%Win rate
6,779Trades
-336,797Max drawdown
365Avg trade

Best run of 15. DAX 40, 4 hours, spread 3, from run sweeps:2026-09-16-DAX40-4h-opt.tsv:2.

Entry rules, long

  1. Yesterday's range is between 20 and 150 points and today is not Friday
  2. Breakout long: buy at market when price is already more than 10% of the range above yesterday's high, or place a buy stop 1 point above that level
  3. Members only
  4. Each of the four entry levels is used at most once per day

Entry rules, short

  1. Yesterday's range is between 20 and 150 points and today is not Friday
  2. Breakout short: sell short at market when price is already more than 10% of the range below yesterday's low, or place a sell stop 1 point below that level
  3. Members only
  4. Each of the four entry levels is used at most once per day

Exit rules

  1. Stop loss of twice the entry margin (10% of the range), minimum 6 points
  2. Members only
  3. While in a trade, an opposite stop order at the other edge reverses the position

Test conditions

PeriodUp to 2026-09-16
InstrumentDAX 40, 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-17

Parameters

startingCapital
Account size used for risk sizing
3000
riskPct
Percent of equity risked per trade
0.5
maxRangePoints
Skip the day if yesterday's range is wider than this
150
minRangePoints
Skip the day if yesterday's range is narrower than this
20
targetRangeMultiple
Profit target as a multiple of yesterday's range
1.5
rangeMarginFraction
Entry levels sit this fraction of the range inside and outside each edge
0.1
stopMarginMultiple
Stop loss as a multiple of the entry margin
2
minStopPoints
Smallest allowed stop loss in points
6
orderOffset
Extra points added to stop entry orders
1
blockedDay
Weekday with no new trades (5 = Friday)
5

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
DAX 40Best run4 hoursn/a 6,77916.482,477,210 EUR-336,797
DAX 40Dailyn/a 4,27321.8319,248,806 EUR-860,999
FTSE 100Dailyn/a 6,73721.794,648,349 EUR-653,406
Nikkei 225Dailyn/a 2,88218.49686,515 USD-50,206
Brent CrudeDailyn/a 2,31521.81410,183 EUR-60,891
Nasdaq 100Dailyn/a 4,13119.7559,003 EUR-6,503
S&P 500Dailyn/a 3,33524.3544,615 EUR-5,773
GoldDailyn/a 1,95927.163,244 EUR-1,039
Dow Jones1 hourn/a 83013.371,903 EUR-1,572
Dow Jones4 hoursn/a 1,01111.771,843 EUR-1,300
Dow Jones30 minn/a 70913.261,816 EUR-1,239
Nasdaq 1005 minn/a 30911.97837 EUR-699
Nasdaq 1003 minn/a 12212.30686 EUR-510
US Crude Oil1 minn/a 3423.53615 EUR-173
Nasdaq 1001 minn/a 1822.22449 EUR-239

Charts

Results by run

Net profit against max drawdown

Net profitMax drawdown
0-1.0M-500K10.0M20.0MDAX 40 · DailyFTSE 100 · DailyDAX 40 · 4 hoursNikkei 225 · DailyBrent Crude · DailyNasdaq 100 · DailyS&P 500 · DailyGold · DailyDow Jones · 1 hourDow Jones · 4 hoursDow Jones · 30 minNasdaq 100 · 5 minNasdaq 100 · 3 minUS Crude Oil · 1 minNasdaq 100 · 1 min

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.

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

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

// --- Parameters ---
startingCapital = 3000        // account size used for risk sizing
riskPct = 0.5                 // percent of equity risked per trade
maxRangePoints = 150          // skip days when yesterday's range is wider than this
minRangePoints = 20           // skip days when yesterday's range is narrower than this
targetRangeMultiple = 1.5     // profit target as a multiple of yesterday's range
rangeMarginFraction = 0.1     // entry levels sit this fraction of the range inside and outside each edge
stopMarginMultiple = 2        // stop loss as a multiple of that margin
minStopPoints = 6             // floor for the stop loss
orderOffset = 1               // extra points added to stop entries
blockedDay = 5                // no new trades on this weekday (Friday)

// Once-per-day entry flags, one per entry level
ONCE lowerEdgeLongDone = 0
ONCE upperEdgeShortDone = 0
ONCE upperBreakLongDone = 0
ONCE lowerBreakShortDone = 0
ONCE tradingAllowed = 0

// --- Indicators ---
// Reset the daily flags on the first bar of every day except the blocked day.
IF DayOfWeek = blockedDay THEN
  tradingAllowed = 0
ELSE
  IF IntradayBarIndex = 0 THEN
    tradingAllowed = 1
    lowerEdgeLongDone = 0
    upperEdgeShortDone = 0
    upperBreakLongDone = 0
    lowerBreakShortDone = 0
  ENDIF
ENDIF

// Entry levels come from the previous completed day's range.
IF IntradayBarIndex = 0 THEN
  rangeHigh = DHigh(1)
  rangeLow = DLow(1)
  rangePoints = ROUND(rangeHigh - rangeLow)
  targetPoints = rangePoints * targetRangeMultiple
  rangeMargin = rangePoints * rangeMarginFraction
  aboveHigh = rangeHigh + rangeMargin
  belowHigh = rangeHigh - rangeMargin
  aboveLow = rangeLow + rangeMargin
  belowLow = rangeLow - rangeMargin
  stopLossPoints = ROUND(rangeMargin * stopMarginMultiple)
  IF stopLossPoints < minStopPoints THEN
    stopLossPoints = minStopPoints
  ENDIF
ENDIF

// Risk a fixed share of current equity on every trade.
equity = startingCapital + StrategyProfit
maxRisk = ROUND(equity * (riskPct / 100))
positionSize = ABS(ROUND((maxRisk / stopLossPoints) / PointValue) * PipSize)

insideRange = close < rangeHigh - rangeMargin AND close > rangeLow + rangeMargin
aboveRange = close > (rangeHigh + rangeMargin)
belowRange = close < (rangeLow - rangeMargin)
nearHigh = close > rangeHigh - rangeMargin AND close < rangeHigh + rangeMargin
nearLow = close < rangeLow + rangeMargin AND close > rangeLow - rangeMargin

92 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Only sweep data exists, so profit factor was not recorded for any run, including the best one on DAX 40 4 hours.
  • The win rate is just 16.48% on the best run. Profits depend on a few large winners, and long losing streaks are normal.
  • Sizing grows with equity, which inflates the headline numbers. The DAX 40 Daily run shows EUR 19,248,805.5 net profit next to a EUR 860,999.0 drawdown, figures that a fixed size account would never see.
  • Up to four pending orders can be live and positions can reverse intraday, which makes live execution and slippage harder to match to the backtest.

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

Does this strategy work with ProOrder automated trading?

Yes, it places stop and limit orders that ProOrder can manage. Because several orders can be pending at once, check the order handling on a demo account first.

Which markets were tested?

Runs were recorded on DAX 40, FTSE 100, Nikkei 225, Brent Crude, Nasdaq 100, S&P 500, Gold, Dow Jones and US Crude Oil, and none of the rows lost money. The best rows are Daily and 4 hour runs, while the 1 minute runs on US Crude Oil and Nasdaq 100 made only EUR 615.0 and EUR 448.5.

How is risk controlled per trade?

Each trade risks 0.5% of equity, with a stop at twice the entry margin and at least 6 points. The best run still had a max drawdown of EUR 336,796.7, because size compounds as equity grows.

Why use daily ranges on a 4 hour chart?

The range comes from the previous day, so a 4 hour chart gives a few bars per session to catch the break or the fakeout without the noise of very short charts.

Related

Strategies like this one

Buy After Price Fall

Best run on the same market, DAX 40.

1.88 PF · 312 trades

Breakout Regime Filter

Also a breakout strategy.

6.28 PF · 70 trades

Bollinger Band Walk

Also a breakout strategy.

3.10 PF · 148 trades

Curious how compounding range systems behave in real accounts? Get on 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