The strategy buys when the close crosses above its 20-bar SMA, or above its 60-bar SMA if no 20-bar cross occurs. It holds a single long position and closes when the close crosses back below the average that opened the trade.
Best run of 12. DAX 40, 4 hours, spread 3, from run pf:2026-10-12-DAX40-4h.tsv:8.
| Period | Up to 2026-10-13 |
| 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-10-13 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| DAX 40Best run | 4 hours | 1.21 | 1,693 | 27.29 | 16,055 EUR | -3,871 |
| USD/JPY | Daily | n/a | 800 | 24.50 | 783,720 USD | -536,750 |
| Nikkei 225 | Daily | n/a | 671 | 28.46 | 32,050 USD | -17,417 |
| Dow Jones | Daily | n/a | 867 | 29.30 | 21,073 EUR | -6,050 |
| Nikkei 225 | 4 hours | n/a | 1,550 | 26.32 | 15,539 USD | -10,249 |
| Dow Jones | 4 hours | n/a | 586 | 27.99 | 9,416 EUR | -7,564 |
| Nasdaq 100 | 4 hours | n/a | 1,680 | 28.45 | 8,873 EUR | -4,837 |
| Nasdaq 100 | Daily | n/a | 634 | 29.18 | 8,471 EUR | -6,372 |
| DAX 40 | Daily | n/a | 839 | 29.32 | 8,178 EUR | -4,492 |
| S&P 500 | Daily | n/a | 836 | 27.87 | 3,251 EUR | -1,023 |
| Gold | Daily | n/a | 790 | 26.46 | 1,955 EUR | -1,950 |
| Gold | 4 hours | n/a | 1,799 | 25.24 | 1,642 EUR | -1,628 |
Charts
Top 10 of 12 runs. The full list is in the table above.
The code
// ============================================================== // Close Above SMA Long // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE leg = 0 smaa = Average[20](close) smab = Average[60](close)
19 more lines: the entry and exit rules.
Setup
Questions
Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.
It was tested on 12 market and timeframe combinations. The best run was DAX 40, 4 hours, with a profit factor of 1.21 over 1,693 trades.
The best run had a maximum drawdown of 3,871 EUR at the tested position size, against a net result of 16,055 EUR.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.