Buys when EMA(21) crosses above EMA(55), with a stop 2 times ATR(14) below and a target 3 times ATR(14) above the entry. Closes the long when EMA(9) crosses under EMA(21).
Best run of 11. S&P 500, Daily, spread 1, from run pf:2026-10-12-USA500-D.tsv:2.
| Period | Up to 2026-10-12 |
| Instrument | S&P 500, Daily |
| Spread | 1 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-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| S&P 500Best run | Daily | 2.38 | 126 | 40.48 | 2,023 EUR | -331 |
| Dow Jones | Daily | 2.05 | 125 | 47.20 | 12,969 EUR | -2,849 |
| Nikkei 225 | 4 hours | n/a | 227 | 41.85 | 9,174 USD | -6,440 |
| Nasdaq 100 | Daily | n/a | 95 | 49.47 | 7,450 EUR | -1,747 |
| Dow Jones | 4 hours | n/a | 96 | 44.79 | 6,344 EUR | -3,601 |
| US Crude Oil | 4 hours | n/a | 206 | 41.26 | 4,964 EUR | -1,426 |
| Dow Jones | 30 min | n/a | 707 | 37.48 | 4,701 EUR | -4,209 |
| USD/JPY | Daily | n/a | 101 | 40.59 | 2,210 USD | -2,200 |
| Brent Crude | 4 hours | n/a | 164 | 42.07 | 1,827 EUR | -1,536 |
| S&P 500 | 1 hour | n/a | 1,067 | 39.64 | 1,364 EUR | -355 |
| S&P 500 | 4 hours | n/a | 278 | 44.96 | 1,345 EUR | -510 |
Charts
Top 10 of 11 runs. The full list is in the table above.
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // EMA Cross With ATR Stops // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long only // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE sl = 0 ONCE tp = 0 slowema = ExponentialAverage[55](close) midema = ExponentialAverage[21](close) fastema = ExponentialAverage[9](close) myAtr = AverageTrueRange[14](close)
14 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 11 market and timeframe combinations. The best run was S&P 500, Daily, with a profit factor of 2.38 over 126 trades.
The best run had a maximum drawdown of 331 EUR at the tested position size, against a net result of 2,023 EUR.
It only takes long trades.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.