A swing high is confirmed when a close is the highest of the surrounding 227 bars, which means it is only known 113 bars later. When price closes back above that level the system buys, and it sells short on the mirror setup. Exits use a 30-point target, a 5-point trailing stop and the 20-bar Donchian channel as a stop.
Best run of 12. S&P 500, 4 hours, spread 1, from run pf:2026-09-15-USA500-4h.tsv:1.
| Period | Up to 2026-09-15 |
| Instrument | S&P 500, 4 hours |
| 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-15 |
| positionSize Contracts per trade | 1 |
| fractalPeriod Bars on each side of a confirmed swing close | 113 |
| longTrailPoints Trailing stop distance for longs (points) | 5 |
| shortTrailPoints Trailing stop distance for shorts (points) | 5 |
| channelPeriod Donchian channel used as the protective stop | 20 |
| takeProfitPoints Profit target (points) | 30 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| S&P 500Best run | 4 hours | 1.71 | 235 | 77.87 | 960 EUR | -343 |
| Gold | 4 hours | 1.60 | 190 | 75.26 | 565 EUR | -125 |
| FTSE 100 | Daily | 1.37 | 132 | 86.36 | 873 EUR | -525 |
| Brent Crude | 1 hour | 1.30 | 477 | 83.65 | 1,983 EUR | -1,413 |
| Dow Jones | 1 hour | 1.24 | 439 | 90.21 | 2,076 EUR | -1,765 |
| USD/JPY | 1 hour | 1.15 | 1,074 | 76.16 | 156,250 JPY | -141,305 |
| Gold | 1 hour | 1.13 | 685 | 55.18 | 379 EUR | -219 |
| Gold | 30 min | 1.10 | 1,215 | 51.36 | 402 EUR | -236 |
| S&P 500 | 1 hour | 1.09 | 956 | 64.02 | 493 EUR | -482 |
| Brent Crude | 30 min | 1.08 | 1,033 | 78.41 | 1,127 EUR | -1,078 |
| Brent Crude | Daily | n/a | 41 | 92.68 | 933 EUR | -614 |
| S&P 500 | Daily | n/a | 83 | 81.93 | 439 EUR | -176 |
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.
// ============================================================ // Fractal Breakout // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 4 hours // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = true DEFPARAM PreloadBars = 10000 // --- Parameters --- positionSize = 1 // contracts per trade fractalPeriod = 113 // bars on each side of a confirmed swing close longTrailPoints = 5 // trailing stop distance for longs (points) shortTrailPoints = 5 // trailing stop distance for shorts (points) channelPeriod = 20 // Donchian channel used as the protective stop takeProfitPoints = 30 // profit target (points) // --- Indicators --- // A swing close is the extreme of the window centred on it, so it is only // confirmed fractalPeriod bars later. The level holds until a new swing forms. isSwingHigh = close[fractalPeriod] >= Highest[2 * fractalPeriod + 1](close) isSwingLow = close[fractalPeriod] <= Lowest[2 * fractalPeriod + 1](close) IF isSwingHigh THEN breakoutHigh = close[fractalPeriod] ENDIF IF isSwingLow THEN breakoutLow = close[fractalPeriod] ENDIF
52 more lines: the entry and exit rules.
Read this first
Questions
Yes. The rewritten code is not yet compile-checked, and the stats come from the version tested before the rewrite.
All eleven rows were positive. Gold 4 hours had a profit factor of 1.6, FTSE 100 Daily 1.37 and Brent Crude 1 hour 1.3.
S&P 500 4 hours had a max drawdown of EUR 343.21 at 1 contract. Dow Jones 1 hour went to EUR 1,765.10.
113 bars on each side picks out only major swing points, so the system reacts to breaks of meaningful levels instead of minor wiggles.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.