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.
Best run of 12. EUR/USD, 5 min, spread 1, from run pf:2026-09-15-EURUSD-5m.tsv:3.
| Period | Up to 2026-09-15 |
| Instrument | EUR/USD, 5 minutes |
| Spread | 1 points |
| Contracts | 1 |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-09-16 |
| 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
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| EUR/USDBest run | 5 min | 2.52 | 114 | 92.98 | 70,128 USD | -18,951 |
| Nikkei 225 | 3 min | 1.87 | 275 | 93.45 | 8,149 USD | -2,223 |
| Nasdaq 100 | 5 min | 1.64 | 200 | 97.00 | 2,822 EUR | -2,310 |
| S&P 500 | 15 min | 1.35 | 432 | 94.44 | 4,696 EUR | -3,613 |
| EUR/USD | 1 hour | 1.17 | 3,709 | 92.32 | 237,581 USD | -76,425 |
| EUR/USD | 4 hours | 1.12 | 3,650 | 92.14 | 170,286 USD | -62,815 |
| EUR/USD | 30 min | 1.08 | 1,627 | 92.62 | 47,155 USD | -106,867 |
| USD/JPY | 1 hour | 1.06 | 2,843 | 92.09 | 715,340 JPY | -525,870 |
| USD/JPY | 1 min | n/a | 26 | 96.15 | 70,000 JPY | -59,250 |
| EUR/USD | 1 min | n/a | 14 | 100.00 | 6,147 USD | -4,184 |
| Gold | 1 min | n/a | 37 | 97.30 | 1,338 EUR | -790 |
| GBP/USD | 1 min | n/a | 24 | 100.00 | 1,149 USD | -625 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
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
Questions
Yes, ProOrder supports partial closes. The code is a rewrite that has not been compile-checked, and the stats are from the earlier version.
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.
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.
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
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.