It buys when SMA(5) crosses above SMA(9) and sells short on the cross below, reversing each time. The stop sits at the 5-bar low or high, with a target twice that risk.
Best run of 3. USD/JPY, Daily, spread 1, from run pf:2026-10-04-USDJPY-D.tsv:13.
| Period | Up to 2026-10-04 |
| 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-04 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| USD/JPYBest run | Daily | 1.25 | 1,660 | 32.11 | 53,820 USD | -12,260 |
| Gold | 4 hours | 1.13 | 3,906 | 36.41 | 2,863 EUR | -705 |
| Brent Crude | Daily | n/a | 644 | 39.13 | 11,810 EUR | -6,997 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // SMA Crossover Swing Stop Target // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false smafast = Average[5](close) smaslow = Average[9](close)
20 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 3 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 1.25 over 1,660 trades.
The best run had a maximum drawdown of 12,260 USD at the tested position size, against a net result of 53,820 USD.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.