Join waitlist
Strategies / Trend / EMA 9 21 Regime Filtered Crossover

EMA 9 21 Regime Filtered Crossover

Buys when the 9-period EMA crosses over the 21-period EMA with the close above the 200-period EMA, and sells short on the opposite cross with the close below it. Positions stay open until an opposite signal reverses them.

TrendLong & shortIntradayGold5 min
1.32Profit factor
3,273Net profit EUR
23.76%Win rate
1,557Trades
-592Max drawdown
2.10Avg trade

Best run of 23. Gold, 5 min, spread 0.6, from run pf:2026-10-04-GOLD-5m.tsv:1.

Entry rules, long

  1. The close is above the 200-period EMA

Entry rules, short

  1. The close is below the 200-period EMA

Exit rules

  1. An opposite signal closes the trade and reverses it

Test conditions

PeriodUp to 2026-10-04
InstrumentGold, 5 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-04

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run5 min1.32 1,55723.763,273 EUR-592
Gold3 min1.31 1,55523.863,438 EUR-662
USD/JPY1 hourn/a 96426.66956,950 USD-300,380
USD/JPY4 hoursn/a 27624.64670,560 USD-379,520
USD/JPY10 minn/a 1,50525.58438,670 USD-305,740
EUR/USDDailyn/a 6237.10155,096 USD-40,420
EUR/USD4 hoursn/a 32026.8893,639 USD-52,297
Nikkei 225Dailyn/a 6338.1058,699 USD-26,197
Dow JonesDailyn/a 7334.2545,279 EUR-11,978
Nasdaq 100Dailyn/a 5036.0030,007 EUR-5,520
Silver5 minn/a 1,74921.6127,203 USD-18,062
Silver15 minn/a 1,64621.6325,575 USD-13,852
DAX 40Dailyn/a 9727.8419,093 EUR-7,174
US Crude Oil1 hourn/a 59828.2615,074 EUR-10,862
Dow Jones4 hoursn/a 6735.8213,703 EUR-6,069
US Crude Oil4 hoursn/a 17427.0111,384 EUR-5,531
Brent Crude4 hoursn/a 12630.1610,857 EUR-6,127
S&P 500Dailyn/a 6737.317,719 EUR-1,395
GBP/USD1 hourn/a 1,32026.827,372 USD-3,930
GoldDailyn/a 8531.764,430 EUR-1,534
Gold4 hoursn/a 20528.292,677 EUR-1,345
Gold1 hourn/a 87825.741,825 EUR-1,247
Gold2 minn/a 1,59223.241,011 EUR-986

Charts

Results by run

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

Above 1.0 made money, below 1.0 lost money.

The code

ProBuilder code, as tested

// ==============================================================
// EMA 9 21 Regime Filtered Crossover
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 5 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

fastema = ExponentialAverage[9](close)
slowema = ExponentialAverage[21](close)
regime = ExponentialAverage[200](close)

12 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

EMA
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • Results include the spread only. Commissions and overnight financing are not included.

Questions

About this strategy

Can I run EMA 9 21 Regime Filtered Crossover 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 23 market and timeframe combinations. The best run was Gold, 5 minutes, with a profit factor of 1.32 over 1,557 trades.

How large was the drawdown?

The best run had a maximum drawdown of 592 EUR at the tested position size, against a net result of 3,273 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Reversal Pattern With Chaikin Volatility

Uses the same indicator.

2.26 PF · 6,872 trades

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

Nine EMA Full Candle Entry

Also a trend strategy.

1.32 PF · 1,405 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