Join waitlist
Strategies / Trend / Trend Breakout With ATR Risk Line

Trend Breakout With ATR Risk Line

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.

TrendLong & shortSwingUSD/JPYDaily
2.07Profit factor
2,303,350Net profit USD
43.26%Win rate
215Trades
-338,070Max drawdown
10,713Avg trade

Best run of 11. USD/JPY, Daily, spread 1, from run pf:2026-10-04-USDJPY-D.tsv:4.

Entry rules, long

  1. The 50-period EMA is above the 200-period EMA, and the 200-period EMA is higher than it was 20 bars ago.

Entry rules, short

  1. The 50-period EMA is below the 200-period EMA, and the 200-period EMA is lower than it was 20 bars ago.

Exit rules

  1. A long closes at market when the close falls below the lowest low of the prior 10 bars.
  2. A short closes at market when the close rises above the highest high of the prior 10 bars.
  3. The short risk line mirrors the long line, falling toward 3 times ATR above the lowest close since entry.

Test conditions

PeriodUp to 2026-10-04
InstrumentUSD/JPY, Daily
Spread1 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-10-04

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
USD/JPYBest runDaily2.07 21543.262,303,350 USD-338,070
Gold4 hours1.41 49841.162,156 EUR-497
EUR/USDDailyn/a 21646.3098,521 USD-30,559
Silver4 hoursn/a 48038.7521,098 USD-13,905
Nikkei 225Dailyn/a 21742.4017,144 USD-16,105
Brent CrudeDailyn/a 8339.768,188 EUR-6,015
Nasdaq 100Dailyn/a 21840.376,819 EUR-3,547
DAX 401 hourn/a 1,91138.884,802 EUR-4,202
Gold30 minn/a 3,25736.262,418 EUR-1,285
GoldDailyn/a 23243.101,500 EUR-1,375
Gold1 hourn/a 1,93638.431,098 EUR-725

Charts

Results by run

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

ProBuilder code, as tested

// ==============================================================
// 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

How to load it

  1. Copy the code with the copy button on the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Indicators used

EMAATR
Longer historyRe-run on up to 1,000,000 barsUSD/JPY · Daily · older data 0.00 USD

USD/JPY had no history beyond the standard run, so both runs used 12,000 bars.

USD/JPY · Daily

Bars available12,000
Net, standard 200,000-bar run2,303,350.00 USD
Net, long run2,303,350.00 USD
Net on the older data alone0.00 USD
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • Results include the spread only. Commissions and overnight financing are not included.

Questions

About this strategy

Can I run Trend Breakout With ATR Risk Line in ProOrder?

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.

Which markets was it tested on?

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.

How large was the drawdown?

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.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Reversal Pattern With Chaikin Volatility

Uses the same indicator.

2.26 PF · 6,872 trades

Trend Surfer

Best run on the same market, USD/JPY.

1.04 PF · 10,813 trades

SuperTrend Trend Following Long

Also a trend strategy.

2.07 PF · 186 trades

Want strategies that are already part of a live portfolio? Join the ProRealAlgos waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs