Join waitlist
Strategies / Trend / ATR Step Trend Line Flip

ATR Step Trend Line Flip

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.

TrendLong & shortSwingUSD/JPYDaily
1.25Profit factor
11,960Net profit USD
45.41%Win rate
392Trades
-2,960Max drawdown
30.51Avg trade

Best run of 7. USD/JPY, Daily, spread 1, from run pf:2026-10-05-USDJPY-D.tsv:6.

Entry rules, long

  1. The close is more than 2.0 times the 200-period ATR above the trend line while the trend is down.

Entry rules, short

  1. The close is more than 2.0 times the 200-period ATR below the trend line while the trend is up.

Exit rules

  1. A long has a stop-loss 2.0 times the 200-period ATR below entry and a target 3.0 times the ATR above entry.
  2. A short has a stop-loss 2.0 times the ATR above entry and a target 3.0 times the ATR below entry.

Test conditions

PeriodUp to 2026-10-05
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-05

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
USD/JPYBest runDaily1.25 39245.4111,960 USD-2,960
US Crude Oil1 hour1.12 2,75540.9114,327 EUR-3,229
Dow JonesDailyn/a 48139.9216,654 EUR-5,136
US Crude Oil4 hoursn/a 74340.247,713 EUR-3,855
Nasdaq 1004 hoursn/a 1,04037.886,676 EUR-3,417
US Crude OilDailyn/a 35142.455,074 EUR-5,003
DAX 401 hourn/a 3,48039.374,553 EUR-4,207

Charts

Results by run

Above 1.0 made money, below 1.0 lost money.

The code

ProBuilder code, as tested

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

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

ATR
Read this firstKnown weaknesses2 points
  • Results include the spread only. Commissions and overnight financing are not included.
  • The code is published as it was backtested and has not been compiled again since.

Questions

About this strategy

Can I run ATR Step Trend Line Flip 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 7 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 1.25 over 392 trades.

How large was the drawdown?

The best run had a maximum drawdown of 2,960 USD at the tested position size, against a net result of 11,960 USD.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

KDJ J Line Momentum Long

Uses the same indicator.

4.17 PF · 6,135 trades

Trend Surfer

Best run on the same market, USD/JPY.

1.04 PF · 10,813 trades

Directional Movement Trend Long

Also a trend strategy.

1.25 PF · 1,365 trades

See how ProRealAlgos combines strategies like this into one automated portfolio.

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