Join waitlist
Strategies / Mean reversion / Swing Midpoint Trend Pullback

Swing Midpoint Trend Pullback

The strategy buys when price is below the midpoint of the latest swing high and swing low but above the 50-bar average. It sells short on the mirror setup, and uses a 2% stop from entry with no profit target.

Mean reversionLong & shortIntradayGold30 min
n/aProfit factor
2,349Net profit EUR
33.15%Win rate
3,710Trades
-1,766Max drawdown
0.63Avg trade

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

Entry rules, long

  1. A swing high and a swing low have both been recorded
  2. The close is above the most recent swing low
  3. The close is above the 50-bar simple moving average
  4. The close is at or above the lowest low of the last 20 bars

Entry rules, short

  1. A swing high and a swing low have both been recorded
  2. The close is below the most recent swing high
  3. The close is below the 50-bar simple moving average
  4. The close is at or below the highest high of the last 20 bars

Exit rules

  1. An opposite signal reverses the position

Test conditions

PeriodUp to 2026-10-07
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-07

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run30 minn/a 3,71033.152,349 EUR-1,766
USD/JPYDailyn/a 26034.232,322,900 USD-830,330
USD/JPY30 minn/a 3,68536.61658,020 USD-316,170
EUR/USDDailyn/a 25537.65137,181 USD-45,419
EUR/USD4 hoursn/a 82337.5556,350 USD-38,012
Nikkei 225Dailyn/a 35417.5127,920 USD-17,283
US Crude OilDailyn/a 47514.9519,645 EUR-5,797
Brent CrudeDailyn/a 20515.6117,655 EUR-4,885
GBP/USDDailyn/a 28434.5111,919 USD-7,118
GoldDailyn/a 37822.492,819 EUR-1,108
Gold4 hoursn/a 57935.921,603 EUR-1,393

Charts

Results by run

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

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Swing Midpoint Trend Pullback
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Mean reversion
// Direction: Long & short
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE swh = 0
ONCE swl = 0
ONCE hasswh = 0
ONCE hasswl = 0

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

SMA
Read this firstKnown weaknesses2 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 1,766 EUR is large next to the net profit of 2,349 EUR.

Questions

About this strategy

Can I run Swing Midpoint Trend Pullback 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 11 market and timeframe combinations. The best run by trade count was Gold, 30 minutes, with 3,710 trades.

How large was the drawdown?

The best run had a maximum drawdown of 1,766 EUR at the tested position size, against a net result of 2,349 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

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

ATR Band

Also a mean reversion strategy.

10.31 PF · 53 trades

Put your name on the ProRealAlgos waitlist to trade a tested portfolio instead of single strategies.

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