This idea buys a breakout above the prior 20-bar high during an uptrend, and sells short the mirror image during a downtrend. Exits use a 10-bar break or an ATR-based risk line that only moves in the trade's favor.
Best run of 11. USD/JPY, Daily, spread 1, from run pf:2026-10-04-USDJPY-D.tsv:4.
| 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 | 2.07 | 215 | 43.26 | 2,303,350 USD | -338,070 |
| Gold | 4 hours | 1.41 | 498 | 41.16 | 2,156 EUR | -497 |
| EUR/USD | Daily | n/a | 216 | 46.30 | 98,521 USD | -30,559 |
| Silver | 4 hours | n/a | 480 | 38.75 | 21,098 USD | -13,905 |
| Nikkei 225 | Daily | n/a | 217 | 42.40 | 17,144 USD | -16,105 |
| Brent Crude | Daily | n/a | 83 | 39.76 | 8,188 EUR | -6,015 |
| Nasdaq 100 | Daily | n/a | 218 | 40.37 | 6,819 EUR | -3,547 |
| DAX 40 | 1 hour | n/a | 1,911 | 38.88 | 4,802 EUR | -4,202 |
| Gold | 30 min | n/a | 3,257 | 36.26 | 2,418 EUR | -1,285 |
| Gold | Daily | n/a | 232 | 43.10 | 1,500 EUR | -1,375 |
| Gold | 1 hour | n/a | 1,936 | 38.43 | 1,098 EUR | -725 |
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
// ============================================================== // Trend Breakout With ATR Risk Line // ProRealAlgos Strategy Library | prorealalgos.com // Type: Trend // Direction: Long & short // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false ONCE waslong = 0 ONCE wasshort = 0 ONCE longpeak = 0 ONCE shorttrough = 0 ONCE longrisk = 0 ONCE shortrisk = 0 fastema = ExponentialAverage[50](close) slowema = ExponentialAverage[200](close) myAtr = AverageTrueRange[14](close) entryhigh = highest[20](high)[1] entrylow = lowest[20](low)[1] exithigh = highest[10](high)[1] exitlow = lowest[10](low)[1]
43 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 | 2,303,350.00 USD |
| Net, long run | 2,303,350.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 11 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 2.07 over 215 trades.
The best run had a maximum drawdown of 338,070 USD at the tested position size, against a net result of 2,303,350 USD.
It trades both long and short.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.