Join today
Strategies / Momentum / Three Bar Momentum Filtered

Three Bar Momentum Filtered

It buys when the close is above the close 3 bars ago and above the 200-period SMA, and sells short on the mirror setup. Trades close on a cross of the 20-period SMA or a 1% stop. The results on this page are losses on every market tested.

MomentumLong & shortIntradayGold30 min
n/aProfit factor
-6,941Net profit EUR
25.87%Win rate
23,572Trades
-10,737Max drawdown
-0.29Avg trade

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

Entry rules, long

  1. Members only
  2. Close is above the 200-period SMA
  3. No position is open

Entry rules, short

  1. Members only
  2. Close is below the 200-period SMA
  3. No position is open

Exit rules

  1. Stop loss at 1% from entry
  2. Members only
  3. Close a short when price closes above the 20-period SMA

Test conditions

PeriodUp to 2026-09-07
InstrumentGold, 30 minutes
Spread0.6 points
Contracts1
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-09-07

Parameters

positionSize
Contracts per trade
1
momentumBars
Compare the close with the close this many bars ago
3
trendPeriod
SMA trend filter length
200
exitPeriod
SMA that closes the trade
20
stopLossPct
Protective stop, percent of entry price
1

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run30 minn/a 23,57225.87-6,941 EUR-10,737
Gold1 hourn/a 13,56825.63-4,970 EUR-6,288
Gold5 minn/a 22,39122.34-10,356 EUR-10,358
Gold15 minn/a 22,45321.05-11,911 EUR-12,096
S&P 5001 hourn/a 13,54424.39-14,786 EUR-14,995
S&P 50030 minn/a 22,61225.37-15,207 EUR-18,100
S&P 50015 minn/a 22,02522.84-22,026 EUR-22,032
S&P 5005 minn/a 22,05219.01-22,731 EUR-22,752
DAX 401 hourn/a 12,58328.60-25,330 EUR-28,320
Nasdaq 1001 hourn/a 13,74623.33-41,427 EUR-42,672
DAX 4030 minn/a 22,62627.44-43,008 EUR-51,969
Nasdaq 10030 minn/a 23,12624.90-43,185 EUR-47,829
Nasdaq 10015 minn/a 22,28225.90-54,500 EUR-54,500
Nasdaq 1005 minn/a 22,20323.76-64,053 EUR-64,138
DAX 405 minn/a 22,33122.51-67,174 EUR-67,332
DAX 4015 minn/a 22,45025.47-75,174 EUR-75,223

Charts

Results by run

Net profit against max drawdown

Net profitMax drawdown
0-100K-50KGold · 1 hourGold · 30 minGold · 5 minGold · 15 minS&P 500 · 1 hourS&P 500 · 30 minS&P 500 · 15 minS&P 500 · 5 minDAX 40 · 1 hourNasdaq 100 · 1 hourDAX 40 · 30 minNasdaq 100 · 30 minNasdaq 100 · 15 minNasdaq 100 · 5 minDAX 40 · 5 minDAX 40 · 15 min

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Three Bar Momentum Filtered
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Momentum
// Direction: Long & short
// Timeframe tested: 30 minutes
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
positionSize = 1          // contracts per trade
momentumBars = 3          // compare the close with the close this many bars ago
trendPeriod = 200         // SMA trend filter length
exitPeriod = 20           // SMA that closes the trade
stopLossPct = 1           // protective stop, percent of entry price

// --- Indicators ---
trendMA = Average[trendPeriod](close)
exitMA = Average[exitPeriod](close)

25 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Every run lost money. The best run on Gold 30 minutes ended at EUR -6,940.7 over 23,572 trades, and DAX 40 15 minutes at EUR -75,174.2.
  • The win rate is 25.87% in the best run, and the frequent entries pile up spread costs.
  • Profit factor was not recorded because all results come from parameter sweeps.

Indicators used

SMA

How to load it

  1. Copy the code with the copy button above 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.

Questions

About this strategy

Should I run this in ProOrder?

The code can run in ProOrder, but no tested market or timeframe was profitable, and the rewritten code was not compile-checked.

What was tested?

DAX 40, Nasdaq 100, S&P 500 and Gold on intraday charts. Gold 1 hour lost the least, ending at EUR -4,970.2.

How large were the drawdowns?

At 1 contract the Gold 30 minute run drew down EUR 10,737, and Nasdaq 100 5 minutes drew down EUR 64,138.2.

Why include a losing strategy?

Seeing what fails helps as much as seeing what works. A simple momentum trigger with a trend filter is not enough on its own here.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Triple Band Market Model

Best run on the same market, Gold.

2.27 PF · 203 trades

Twelve Minus Two Momentum

Also a momentum strategy.

12.00 PF · 52 trades

We test hundreds of ideas so only the survivors trade live. Join the ProRealAlgos waitlist to see them.

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