Buys when the 21-bar EMA crosses above the 50-bar EMA and sells short when it crosses below. Each trade has a stop 2 times ATR(14) from the entry and a target twice that distance.
Best run of 6. USD/JPY, Daily, spread 1, from run pf:2026-10-05-USDJPY-D.tsv:2.
| Period | Up to 2026-10-05 |
| Instrument | USD/JPY, 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-05 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBest run | Daily | 1.60 | 222 | 41.89 | 16,320 USD | -2,160 |
| US Crude Oil | Daily | 1.52 | 202 | 40.10 | 14,776 EUR | -3,021 |
| Nikkei 225 | 4 hours | n/a | 468 | 33.12 | 12,376 USD | -9,802 |
| Brent Crude | Daily | n/a | 89 | 44.94 | 11,675 EUR | -3,440 |
| Nasdaq 100 | Daily | n/a | 188 | 34.04 | 7,600 EUR | -4,364 |
| Nasdaq 100 | 1 hour | n/a | 2,199 | 29.65 | 6,121 EUR | -3,983 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // EMA Crossover With ATR Stops // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false fast = ExponentialAverage[21](close) slow = ExponentialAverage[50](close) myAtr = AverageTrueRange[14](close) dist = 2 * myAtr
13 more lines: the entry and exit rules.
Setup
USD/JPY had no history beyond the standard run, so both runs used 12,000 bars.
| Bars available | 12,000 |
| Net, standard 200,000-bar run | 16,320.00 USD |
| Net, long run | 16,320.00 USD |
| Net on the older data alone | 0.00 USD |
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 6 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 1.60 over 222 trades.
The best run had a maximum drawdown of 2,160 USD at the tested position size, against a net result of 16,320 USD.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.