Join today
Strategies / Breakout / Two-Day Range Midline Cross

Two-Day Range Midline Cross

The system builds a range from today and the previous day and trades when the close crosses its midpoint, as long as a 56-period trend average agrees. Longs open with 4 units and shorts with 3, taking partial profits at fixed point levels. The last unit exits on a 33-point trailing stop or a 200-point stop.

BreakoutLong & shortIntradayEUR/USD5 min
2.52Profit factor
70,128Net profit USD
92.98%Win rate
114Trades
-18,951Max drawdown
615Avg trade

Best run of 12. EUR/USD, 5 min, spread 1, from run pf:2026-09-15-EURUSD-5m.tsv:3.

Entry rules, long

  1. Members only
  2. Close crosses above the middle of the two-day high-low range
  3. Not a weekend bar and no short open

Entry rules, short

  1. Members only
  2. Close crosses below the middle of the two-day range
  3. Not a weekend bar and no long open

Exit rules

  1. Members only
  2. Shorts open with 3 contracts and scale out one contract each at -40 and -78 points
  3. Trailing stop 33 points behind the best close once in profit by 33 points
  4. Stop loss 200 points

Test conditions

PeriodUp to 2026-09-15
InstrumentEUR/USD, 5 minutes
Spread1 points
Contracts1
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

positionSize
Base unit; entries and each partial exit use multiples of it
1
longSizeMultiplier
Longs open with 4 units and scale out
4
shortSizeMultiplier
Shorts open with 3 units and scale out
3
daysBack
Range covers today plus this many previous days
1
trendPeriod
Trend average length
56
trendMAType
Average type of the trend average (applied to total price)
3
levelPeriod
Smoothing length of the upper and lower levels
10
levelMAType
Average type of the level smoothing
4
longTargetOne
First long partial exit, points above entry
40
longTargetTwo
Second long partial exit, points above entry
20
longTargetThree
Third long partial exit, points above entry
18
shortTargetOne
First short partial exit, points below entry
40
shortTargetTwo
Second short partial exit, points below entry
78
trailStopPoints
Trailing stop distance from the best close
33
stopLossPoints
Protective stop in points
200

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
EUR/USDBest run5 min2.52 11492.9870,128 USD-18,951
Nikkei 2253 min1.87 27593.458,149 USD-2,223
Nasdaq 1005 min1.64 20097.002,822 EUR-2,310
S&P 50015 min1.35 43294.444,696 EUR-3,613
EUR/USD1 hour1.17 3,70992.32237,581 USD-76,425
EUR/USD4 hours1.12 3,65092.14170,286 USD-62,815
EUR/USD30 min1.08 1,62792.6247,155 USD-106,867
USD/JPY1 hour1.06 2,84392.09715,340 JPY-525,870
USD/JPY1 minn/a 2696.1570,000 JPY-59,250
EUR/USD1 minn/a 14100.006,147 USD-4,184
Gold1 minn/a 3797.301,338 EUR-790
GBP/USD1 minn/a 24100.001,149 USD-625

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.01.32.53.85.01.0 = break-evenEUR/USD · 5 min2.52Nikkei 225 · 3 min1.87Nasdaq 100 · 5 min1.64S&P 500 · 15 min1.35EUR/USD · 1 hour1.17EUR/USD · 4 hours1.12EUR/USD · 30 min1.08USD/JPY · 1 hour1.06

Net profit against max drawdown

Net profitMax drawdown
0-1.0M-500K500K1.0MUSD/JPY · 1 hourEUR/USD · 1 hourEUR/USD · 4 hoursEUR/USD · 5 minUSD/JPY · 1 minEUR/USD · 30 minNikkei 225 · 3 minEUR/USD · 1 minS&P 500 · 15 minNasdaq 100 · 5 minGold · 1 minGBP/USD · 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.

// ============================================================
// Two-Day Range Midline Cross
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Breakout
// Direction: Long & short
// Timeframe tested: 5 minutes
// ============================================================

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

// --- Parameters ---
positionSize = 1              // base unit; entries and each partial exit use multiples of it
longSizeMultiplier = 4        // longs open with 4 units and scale out
shortSizeMultiplier = 3       // shorts open with 3 units and scale out
daysBack = 1                  // range covers today plus this many previous days
trendPeriod = 56              // trend average length
trendMAType = 3               // average type of the trend average (applied to total price)
levelPeriod = 10              // smoothing length of the upper and lower levels
levelMAType = 4               // average type of the level smoothing
longTargetOne = 40            // first long partial exit, points above entry
longTargetTwo = 20            // second long partial exit, points above entry
longTargetThree = 18          // third long partial exit, points above entry
shortTargetOne = 40           // first short partial exit, points below entry
shortTargetTwo = 78           // second short partial exit, points below entry
trailStopPoints = 33          // trailing stop distance from the best close
stopLossPoints = 200          // protective stop in points

// --- Indicators ---
weekendBar = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

trendMA = Average[trendPeriod, trendMAType](TotalPrice)

// Highest high and lowest low of today and the previous day(s).
rangeHigh = 0
FOR i = 0 TO daysBack DO
  IF DHigh(i) > rangeHigh OR rangeHigh = 0 THEN
    rangeHigh = DHigh(i)
  ENDIF
NEXT

rangeLow = 0
FOR i = 0 TO daysBack DO
  IF DLow(i) < rangeLow OR rangeLow = 0 THEN
    rangeLow = DLow(i)
  ENDIF
NEXT

midLevel = (rangeHigh + rangeLow) / 2
upperLevel = Average[levelPeriod, levelMAType]((rangeHigh + midLevel) / 2)
lowerLevel = Average[levelPeriod, levelMAType]((rangeLow + midLevel) / 2)

59 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • The best run on EUR/USD 5 minutes had only 114 trades.
  • Win rates above 92% come with a 200-point stop against much smaller targets. A max drawdown of USD 18,951 against USD 70,128 profit shows how costly the rare losers are.
  • Position size changes during a trade (4 units in for longs, 3 for shorts), so real exposure is several times positionSize.
  • Several 1 minute rows have very few trades, such as 14 on EUR/USD and 24 on GBP/USD, and no recorded profit factor.

Indicators used

SMA

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

Can it run in ProOrder with partial exits?

Yes, ProOrder supports partial closes. The code is a rewrite that has not been compile-checked, and the stats are from the earlier version.

How did it do outside EUR/USD?

Nikkei 225 3 minutes had a profit factor of 1.87 and Nasdaq 100 5 minutes 1.64. USD/JPY 1 hour made JPY 715,340 but with a profit factor of only 1.06.

What capital does it need?

The best run's max drawdown was USD 18,951 with a base size of 1, meaning 4 units on longs and 3 on shorts. Plan around that drawdown.

Why a two-day range?

Using today plus one previous day gives a midline that reacts faster than a weekly level but is less noisy than a single session.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Slow MACD Slope

Best run on the same market, EUR/USD.

6.80 PF · 7,305 trades

Turtle Trade

A similar profit factor.

2.42 PF · 6,324 trades

Interested in how scale-out systems are managed live? 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