Join waitlist
Strategies / Trend / Adaptive Trend Flow Long

Adaptive Trend Flow Long

A band-based trend state turns bullish when the close breaks above the upper band. It buys on that flip when the close is above the 4-bar SMA and MACD is above its signal line, and exits when the trend turns bearish.

TrendLong onlySwingUSD/JPY4 hours
n/aProfit factor
531,010Net profit USD
36.90%Win rate
2,103Trades
-241,880Max drawdown
253Avg trade

Best run of 7. USD/JPY, 4 hours, spread 1, from run sweeps:2026-10-12-USDJPY-4h-opt.tsv:25.

Entry rules, long

  1. The close is above the 4-bar SMA.
  2. The MACD line, EMA(2) minus EMA(7) of the close, is above its 2-bar EMA signal line.

Exit rules

  1. The trend state flips from 1 to -1 when the close is below the lower band.

Test conditions

PeriodUp to 2026-10-12
InstrumentUSD/JPY, 4 hours
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-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
USD/JPYBest run4 hoursn/a 2,10336.90531,010 USD-241,880
Nikkei 225Dailyn/a 61538.8620,581 USD-20,311
DAX 404 hoursn/a 1,79039.8313,211 EUR-4,512
DAX 40Dailyn/a 58039.486,892 EUR-5,307
Nasdaq 100Dailyn/a 68540.295,529 EUR-4,419
Gold4 hoursn/a 1,84537.722,506 EUR-738
GoldDailyn/a 72535.171,960 EUR-1,349

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Adaptive Trend Flow Long
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long only
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE trend = 0
ONCE init = 0

typ = TypicalPrice
fast = ExponentialAverage[2](typ)
slow = ExponentialAverage[4](typ)
basis = (fast + slow) / 2
vol = STD[2](typ)
svol = ExponentialAverage[2](vol)
upper = basis + svol * 2
lower = basis - svol * 2
sma = Average[4](close)
myMacd = ExponentialAverage[2](close) - ExponentialAverage[7](close)
signal = ExponentialAverage[2](myMacd)

prevtrend = trend

29 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

EMASMAMACDStandard Deviation
Read this firstKnown weaknesses2 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.

Questions

About this strategy

Can I run Adaptive Trend Flow Long 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 by trade count was USD/JPY, 4 hours, with 2,103 trades.

How large was the drawdown?

The best run had a maximum drawdown of 241,880 USD at the tested position size, against a net result of 531,010 USD.

Does it trade long, short or both?

It only takes long trades.

Related

Strategies like this one

Trend Surfer

Uses the same indicator.

1.04 PF · 10,813 trades

EMA 8 21 RSI Filtered Bracket

Best run on the same market, USD/JPY.

1.09 PF · 6,194 trades

ADX Filtered EMA Cross

Also a trend strategy.

1.15 PF · 607 trades

Get the full rules, the complete code and the ProRealAlgos portfolio as a member.

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