Join waitlist
Strategies / Trend / Reference Bar Structure Flip

Reference Bar Structure Flip

Buys when the close breaks above the high of a reference bar that resets on new lows. Closes the long when the close breaks below the low of a reference bar that resets on new highs.

TrendLong onlySwingDAX 404 hours
n/aProfit factor
12,015Net profit EUR
39.04%Win rate
2,431Trades
-4,725Max drawdown
4.94Avg trade

Best run of 4. DAX 40, 4 hours, spread 3, from run sweeps:2026-10-11-DAX40-4h-opt.tsv:102.

Entry rules, long

  1. In a down state, the reference bar resets to the current bar whenever the low reaches or breaks the reference low.

Exit rules

  1. In an up state, the reference bar resets whenever the high takes a new high.

Test conditions

PeriodUp to 2026-10-11
InstrumentDAX 40, 4 hours
Spread3 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-11

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
DAX 40Best run4 hoursn/a 2,43139.0412,015 EUR-4,725
Dow JonesDailyn/a 1,36538.7514,041 EUR-9,219
Nasdaq 1004 hoursn/a 2,36838.1813,105 EUR-6,161
Gold4 hoursn/a 2,28136.121,175 EUR-1,155

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Reference Bar Structure Flip
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long only
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE init = 0
ONCE trend = 0
ONCE sh = 0
ONCE sl = 0

chup = 0
chdn = 0
IF init = 0 THEN

38 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.
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 Reference Bar Structure 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 4 market and timeframe combinations. The best run by trade count was DAX 40, 4 hours, with 2,431 trades.

How large was the drawdown?

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

Does it trade long, short or both?

It only takes long trades.

Related

Strategies like this one

Heikin Ashi Color Flip

Best run on the same market, DAX 40.

1.12 PF · 3,692 trades

ADX Filtered EMA Cross

Also a trend strategy.

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