Join waitlist
Strategies / Trend / ATR Trail Flip Trend Filter

ATR Trail Flip Trend Filter

Tracks a trailing line 2.0 times the 14-period ATR from the close, which flips side when price crosses it. Goes long on a flip up when the close is above the 200-period EMA, and short on a flip down when it is below.

TrendLong & shortIntradayGold3 min
1.41Profit factor
4,422Net profit EUR
27.27%Win rate
1,507Trades
-740Max drawdown
2.93Avg trade

Best run of 20. Gold, 3 min, spread 0.6, from run pf:2026-10-04-GOLD-3m.tsv:1.

Entry rules, long

  1. The close is above the 200-period EMA.

Entry rules, short

  1. The close is below the 200-period EMA.

Exit rules

  1. A flip that fails the EMA filter is ignored, and the current position is kept.
  2. The trailing line sets no stop or target orders.

Test conditions

PeriodUp to 2026-10-04
InstrumentGold, 3 minutes
Spread0.6 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
GoldBest run3 min1.41 1,50727.274,422 EUR-740
USD/JPYDailyn/a 9533.682,114,430 USD-848,800
USD/JPY1 hourn/a 1,00827.68790,320 USD-318,130
USD/JPY10 minn/a 1,54925.95321,360 USD-201,350
EUR/USDDailyn/a 7247.22218,224 USD-41,810
Nikkei 225Dailyn/a 7932.9154,679 USD-16,107
Nasdaq 100Dailyn/a 7433.7824,073 EUR-5,520
DAX 40Dailyn/a 11028.1815,800 EUR-10,002
GBP/USDDailyn/a 10029.0014,039 USD-6,560
US Crude OilDailyn/a 8430.9512,980 EUR-7,285
GBP/USD1 hourn/a 1,35427.257,544 USD-3,634
GBP/USD4 hoursn/a 38727.394,412 USD-4,302
GoldDailyn/a 9723.713,418 EUR-1,978
S&P 500Dailyn/a 9136.262,873 EUR-1,691
Gold5 minn/a 1,55924.822,839 EUR-899
Gold10 minn/a 1,54323.982,772 EUR-1,027
Gold30 minn/a 1,51827.732,197 EUR-1,581
Gold1 hourn/a 91826.251,622 EUR-1,521
Gold2 minn/a 1,56024.741,493 EUR-955
Gold15 minn/a 1,60122.611,424 EUR-1,058

Charts

Results by run

Top 10 of 20 runs. The full list is in the table above.

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// ATR Trail Flip Trend Filter
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 3 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE trail = 0
ONCE uptrend = 1
ONCE init = 0

myAtr = AverageTrueRange[14](close)
ema = ExponentialAverage[200](close)
longstop = close - myAtr * 2.0
shortstop = close + myAtr * 2.0

prevup = uptrend

40 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

ATREMA
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 Trail Flip Trend Filter 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 20 market and timeframe combinations. The best run was Gold, 3 minutes, with a profit factor of 1.41 over 1,507 trades.

How large was the drawdown?

The best run had a maximum drawdown of 740 EUR at the tested position size, against a net result of 4,422 EUR.

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

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

EMA Crossover With RSI Filter (long and short)

Also a trend strategy.

1.40 PF · 869 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