Join waitlist
Strategies / Trend / Follow Line Trend Flip

Follow Line Trend Flip

The system tracks a trailing line that moves up or down when price breaks outside a 21-period Bollinger Band, using a 5-period ATR offset. It buys when the line turns up and sells short when it turns down, reversing any open position.

TrendLong & shortIntradayGold30 min
n/aProfit factor
1,675Net profit EUR
36.22%Win rate
4,583Trades
-1,466Max drawdown
0.37Avg trade

Best run of 9. Gold, 30 min, spread 0.6, from run sweeps:2026-10-12-GOLD-30m-opt.tsv:44.

Entry rules, long

  1. The trend turns up from flat or falling.

Entry rules, short

  1. The trend turns down from flat or rising.

Exit rules

  1. While short, a rising line (trend 1) closes the position.

Test conditions

PeriodUp to 2026-10-12
InstrumentGold, 30 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-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run30 minn/a 4,58336.221,675 EUR-1,466
Nikkei 225Dailyn/a 35837.4323,157 USD-20,826
Brent CrudeDailyn/a 13740.8819,512 EUR-9,169
Dow Jones1 hourn/a 96338.5317,804 EUR-6,962
Nasdaq 100Dailyn/a 33136.5611,711 EUR-5,676
US Crude Oil30 minn/a 4,17937.386,901 EUR-6,794
Gold4 hoursn/a 80139.203,431 EUR-913
GoldDailyn/a 41635.342,958 EUR-1,365
Gold1 hourn/a 2,82936.232,635 EUR-976

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Follow Line Trend Flip
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE line = 0
ONCE hasline = 0
ONCE trend = 0

basis = Average[21](close)
dev = STD[21](close) * 1.0
myAtr = AverageTrueRange[5](close)

51 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

Bollinger BandsATR
Read this firstKnown weaknesses3 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 1,466 EUR is large next to the net profit of 1,675 EUR.
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.

Questions

About this strategy

Can I run Follow Line Trend 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 9 market and timeframe combinations. The best run by trade count was Gold, 30 minutes, with 4,583 trades.

How large was the drawdown?

The best run had a maximum drawdown of 1,466 EUR at the tested position size, against a net result of 1,675 EUR.

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

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

ADX Filtered EMA Cross

Also a trend strategy.

1.15 PF · 607 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