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.
Best run of 15. DAX 40, 4 hours, spread 3, from run sweeps:2026-09-16-DAX40-4h-opt.tsv:2.
| Period | Up to 2026-09-16 |
| Instrument | DAX 40, 4 hours |
| Spread | 3 points |
| 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-17 |
| 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
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| DAX 40Best run | 4 hours | n/a | 6,779 | 16.48 | 2,477,210 EUR | -336,797 |
| DAX 40 | Daily | n/a | 4,273 | 21.83 | 19,248,806 EUR | -860,999 |
| FTSE 100 | Daily | n/a | 6,737 | 21.79 | 4,648,349 EUR | -653,406 |
| Nikkei 225 | Daily | n/a | 2,882 | 18.49 | 686,515 USD | -50,206 |
| Brent Crude | Daily | n/a | 2,315 | 21.81 | 410,183 EUR | -60,891 |
| Nasdaq 100 | Daily | n/a | 4,131 | 19.75 | 59,003 EUR | -6,503 |
| S&P 500 | Daily | n/a | 3,335 | 24.35 | 44,615 EUR | -5,773 |
| Gold | Daily | n/a | 1,959 | 27.16 | 3,244 EUR | -1,039 |
| Dow Jones | 1 hour | n/a | 830 | 13.37 | 1,903 EUR | -1,572 |
| Dow Jones | 4 hours | n/a | 1,011 | 11.77 | 1,843 EUR | -1,300 |
| Dow Jones | 30 min | n/a | 709 | 13.26 | 1,816 EUR | -1,239 |
| Nasdaq 100 | 5 min | n/a | 309 | 11.97 | 837 EUR | -699 |
| Nasdaq 100 | 3 min | n/a | 122 | 12.30 | 686 EUR | -510 |
| US Crude Oil | 1 min | n/a | 34 | 23.53 | 615 EUR | -173 |
| Nasdaq 100 | 1 min | n/a | 18 | 22.22 | 449 EUR | -239 |
Charts
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.
// ============================================================ // 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
Questions
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.
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.
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.
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
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.