The system buys 1 contract when the close is above its 20-period SMA and sells short when it is below. It closes the position when price crosses back through the average, then takes the opposite side on the following bar.
Best run of 3. USD/JPY, Daily, spread 1, from run pf:2026-10-05-USDJPY-D.tsv:4.
| 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.39 | 1,240 | 27.98 | 3,385,830 USD | -428,370 |
| Silver | Daily | n/a | 1,132 | 28.18 | 32,312 USD | -28,236 |
| Nikkei 225 | Daily | n/a | 1,043 | 30.11 | 31,511 USD | -17,978 |
Charts
The code
// ============================================================== // SMA 20 Price Flip System // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false sma = Average[20](close)
17 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.39 over 1,240 trades.
The best run had a maximum drawdown of 428,370 USD at the tested position size, against a net result of 3,385,830 USD.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.