Join today
Strategies / Trend / EMA 20/50 Cross

EMA 20/50 Cross: A Plain Crossover With a 1% Stop

The 20-period EMA crossing the 50-period EMA opens a trade in the direction of the cross. A long closes when the 20 EMA drops back under the 50 EMA, a short when it climbs back above, and a 1% stop sits behind every trade.

TrendLong & shortSwingGold1 hour
1.22Profit factor
2,194Net profit EUR
29.74%Win rate
1,288Trades
-1,197Max drawdown
1.70Avg trade

Best run of 16. Gold, 1 hour, spread 0.6, from run pf:2026-09-15-GOLD-1h.tsv:3.

Entry rules, long

  1. Members only
  2. No position is open

Entry rules, short

  1. Members only
  2. No position is open

Exit rules

  1. Stop loss at 1% from entry
  2. Members only
  3. Close a short when the 20 EMA is back above the 50 EMA

Test conditions

PeriodUp to 2026-09-15
InstrumentGold, 1 hour
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-15

Parameters

positionSize
Contracts per trade
1
fastPeriod
Fast EMA length
20
slowPeriod
Slow EMA length
50
stopLossPct
Protective stop, percent of entry price
1

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run1 hour1.22 1,28829.742,194 EUR-1,197
Gold5 min1.11 1,96626.701,165 EUR-1,388
Nasdaq 1001 hourn/a 1,40126.986,023 EUR-6,902
DAX 4015 minn/a 1,94028.664,448 EUR-4,448
Nasdaq 1005 minn/a 1,88527.113,611 EUR-7,028
S&P 5001 hourn/a 1,34128.78835 EUR-1,426
Gold30 minn/a 1,98427.57805 EUR-1,364
S&P 50030 minn/a 1,96527.94496 EUR-1,149
DAX 4030 minn/a 2,02229.5381.60 EUR-5,966
DAX 401 hourn/a 1,31127.08-291 EUR-6,515
S&P 50015 minn/a 1,95129.06-679 EUR-1,754
Gold15 minn/a 1,96324.76-1,259 EUR-2,012
S&P 5005 minn/a 1,92923.74-1,424 EUR-1,833
Nasdaq 10030 minn/a 2,04627.52-5,055 EUR-6,302
Nasdaq 10015 minn/a 2,01428.55-5,075 EUR-10,960
DAX 405 minn/a 2,00126.29-6,743 EUR-6,898

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.00.51.01.52.01.0 = break-evenGold · 1 hour1.22Gold · 5 min1.11

Net profit against max drawdown

Net profitMax drawdown
0-20K-10K5K10KNasdaq 100 · 1 hourDAX 40 · 15 minNasdaq 100 · 5 minGold · 1 hourGold · 5 minS&P 500 · 1 hourGold · 30 minS&P 500 · 30 minDAX 40 · 30 minDAX 40 · 1 hourS&P 500 · 15 minGold · 15 minS&P 500 · 5 minNasdaq 100 · 30 minNasdaq 100 · 15 minDAX 40 · 5 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.

// ============================================================
// EMA 20/50 Cross
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 1 hour
// ============================================================

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

// --- Parameters ---
positionSize = 1          // contracts per trade
fastPeriod = 20           // fast EMA length
slowPeriod = 50           // slow EMA length
stopLossPct = 1           // protective stop, percent of entry price

// --- Indicators ---
fastMA = ExponentialAverage[fastPeriod](close)
slowMA = ExponentialAverage[slowPeriod](close)

25 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Results split roughly in half. Of the 15 extra runs in the table, 7 lost money, including DAX 40 on 5 minutes at -6,743 EUR and Nasdaq 100 on 15 minutes at -5,075.40 EUR.
  • The best run on Gold 1 hour has a profit factor of only 1.22 and an average trade of 1.70 EUR, which leaves little room for extra costs.
  • Win rates stay below 30% (29.74% in the best run), so long losing streaks are normal.
  • Most runs outside the headline only have sweep data, so their profit factor was not recorded.

Indicators used

EMA

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

Can it trade live in ProOrder?

Yes. The cross, the reverse cross exit and the 1% stop are all automated. The stats come from the pre-rewrite version, so demo test the new code first.

How did it hold up across markets?

Gold 1 hour made 2,194.30 EUR over 1288 trades. Nasdaq 100 1 hour made 6,023.10 EUR but with a 6,901.70 EUR drawdown, while S&P 500 on 5 and 15 minutes lost.

What does 1 contract risk?

With 1 contract and a 0.6 point spread, the Gold 1 hour run had a max drawdown of 1,196.80 EUR. Nasdaq 100 on 15 minutes reached 10,959.70 EUR.

Why test on intraday charts only?

The 20/50 pair reacts within a session on 5 minute to 1 hour bars. The 1 hour chart gave the best profit factor on Gold.

Related

Strategies like this one

Monday Dip Buy

Uses the same indicator.

n/a PF · 146 trades

Triple Band Market Model

Best run on the same market, Gold.

2.27 PF · 203 trades

KAMA SMA Cross

A similar profit factor.

1.21 PF · 548 trades

Compare notes on crossover systems with other traders. 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