Join waitlist
Strategies / Trend / Reversal Pattern With Shifted Averages

Reversal Pattern With Shifted Averages

The system buys when a stochastic-based close reversal agrees with three shifted averages of the median price in bullish order, and sells short on the bearish mirror. Open positions close when the states no longer agree.

TrendLong & shortIntradayDAX 4030 min
n/aProfit factor
13,177Net profit EUR
35.04%Win rate
4,252Trades
-6,463Max drawdown
3.10Avg trade

Best run of 6. DAX 40, 30 min, spread 3, from run sweeps:2026-10-12-DAX40-30m-opt.tsv:44.

Entry rules, long

  1. The close is above the prior close, and the prior close was below the close 2 bars earlier.
  2. The median price SMA lines are in bullish order: 5-period (shifted 3 bars) above 8-period (shifted 5 bars) above 13-period (shifted 8 bars).
  3. The close is above the shortest of these averages.
  4. When both states are bullish and no long is open, the system buys 1 contract at market.

Entry rules, short

  1. The close is below the prior close, and the prior close was above the close 2 bars earlier.
  2. The median price SMA lines are in bearish order: 5-period (shifted 3 bars) below 8-period (shifted 5 bars) below 13-period (shifted 8 bars).
  3. The close is below the shortest of these averages.
  4. When both states are bearish and no short is open, the system sells 1 contract short at market.

Exit rules

  1. When they no longer agree, an open short is bought back at market.

Test conditions

PeriodUp to 2026-10-12
InstrumentDAX 40, 30 minutes
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-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
DAX 40Best run30 minn/a 4,25235.0413,177 EUR-6,463
Nikkei 225Dailyn/a 22440.1821,494 USD-19,805
Brent CrudeDailyn/a 10238.2415,060 EUR-6,966
Gold1 hourn/a 2,58235.942,441 EUR-734
GoldDailyn/a 27340.292,324 EUR-809
Gold4 hoursn/a 65338.131,228 EUR-973

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Reversal Pattern With Shifted Averages
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE myK = 50
ONCE nabar = -100
ONCE posrev = 0
ONCE posbw = 0

hh = highest[14](high)
ll = lowest[14](low)

49 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

StochasticSMA
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 Reversal Pattern With Shifted Averages 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 6 market and timeframe combinations. The best run by trade count was DAX 40, 30 minutes, with 4,252 trades.

How large was the drawdown?

The best run had a maximum drawdown of 6,463 EUR at the tested position size, against a net result of 13,177 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Trend Surfer

Uses the same indicator.

1.04 PF · 10,813 trades

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