The idea is to fade failed breakouts. A close under the lowest low of the previous 5 bars in an uptrend (21 EMA above 30 EMA) triggers a buy at the next open, and shorts mirror it. Trades exit when price breaks the opposite 5-bar extreme or hits a 3 x ATR(20) stop.
Best run of 9. S&P 500, Daily, spread 1, from run pf:2026-09-24-USA500-D.tsv:5.
| Period | Up to 2026-09-25 |
| Instrument | S&P 500, Daily |
| 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-25 |
| positionSize Contracts per trade | 1 |
| lookbackPeriod Bars for the recent high and low | 5 |
| fastPeriod Fast EMA of the trend filter | 21 |
| slowPeriod Slow EMA of the trend filter | 30 |
| atrPeriod ATR length for the stop | 20 |
| atrMultiplier Stop distance in ATRs | 3 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| S&P 500Best run | Daily | 1.26 | 867 | 53.52 | 2,651 EUR | -758 |
| USD/JPY | Daily | n/a | 706 | 64.16 | 594,850 JPY | -519,470 |
| EUR/USD | Daily | n/a | 676 | 62.72 | 80,084 USD | -25,971 |
| EUR/USD | 4 hours | n/a | 2,371 | 61.83 | 76,581 USD | -26,468 |
| Nikkei 225 | Daily | n/a | 660 | 61.67 | 12,768 USD | -12,607 |
| Brent Crude | Daily | n/a | 288 | 61.81 | 11,720 EUR | -5,440 |
| Dow Jones | Daily | n/a | 791 | 62.83 | 10,574 EUR | -7,567 |
| US Crude Oil | Daily | n/a | 633 | 60.98 | 7,497 EUR | -6,879 |
| Nasdaq 100 | Daily | n/a | 649 | 60.40 | 5,991 EUR | -4,518 |
Charts
The code
// ============================================================ // Turtle Soup // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade lookbackPeriod = 5 // bars for the recent high and low fastPeriod = 21 // fast EMA of the trend filter slowPeriod = 30 // slow EMA of the trend filter atrPeriod = 20 // ATR length for the stop atrMultiplier = 3 // stop distance in ATRs // --- Indicators --- recentHigh = Highest[lookbackPeriod](high)[1] recentLow = Lowest[lookbackPeriod](low)[1] fastMA = ExponentialAverage[fastPeriod](close) slowMA = ExponentialAverage[slowPeriod](close) stopDistance = atrMultiplier * AverageTrueRange[atrPeriod](close)
28 more lines: the entry and exit rules.
Setup
Questions
Yes. Entries, both exits and the ATR stop are coded, at 1 contract per trade.
S&P 500 daily gave profit factor 1.26 and EUR 2,651.09 over 867 trades. All eight tested runs were profitable, including EUR/USD daily at USD 80,084.00.
S&P 500 daily had a max drawdown of EUR 757.64.
False breaks of a 5-bar range carry more meaning on daily charts. EUR/USD 4 hours worked too, over 2,371 trades.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.