Tracks a trend line that moves by a fraction of the 200-period ATR and flips direction when price moves more than 2.0 times that ATR beyond it. Each trade has a stop-loss 2.0 times the ATR and a target 3.0 times the ATR.
Best run of 7. USD/JPY, Daily, spread 1, from run pf:2026-10-05-USDJPY-D.tsv:6.
| 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.25 | 392 | 45.41 | 11,960 USD | -2,960 |
| US Crude Oil | 1 hour | 1.12 | 2,755 | 40.91 | 14,327 EUR | -3,229 |
| Dow Jones | Daily | n/a | 481 | 39.92 | 16,654 EUR | -5,136 |
| US Crude Oil | 4 hours | n/a | 743 | 40.24 | 7,713 EUR | -3,855 |
| Nasdaq 100 | 4 hours | n/a | 1,040 | 37.88 | 6,676 EUR | -3,417 |
| US Crude Oil | Daily | n/a | 351 | 42.45 | 5,074 EUR | -5,003 |
| DAX 40 | 1 hour | n/a | 3,480 | 39.37 | 4,553 EUR | -4,207 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
// ============================================================== // ATR Step Trend Line Flip // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE tline = 0 ONCE tdir = 1 ONCE tstep = 0 ONCE isfast = 0 myAtr = AverageTrueRange[200](close) sigl = 0 sigs = 0 IF BarIndex = 0 THEN tline = close ENDIF
42 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 7 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 1.25 over 392 trades.
The best run had a maximum drawdown of 2,960 USD at the tested position size, against a net result of 11,960 USD.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.