Join waitlist
Strategies / Trend / EMA Crossover With MACD Filter (long and short)

EMA Crossover With MACD Filter (long and short)

The system buys when the EMA(9) crosses above EMA(21) with RSI(14) between 30 and 70 and MACD above its signal line, and sells short on the mirror setup. Each trade uses a stop at 1.0 times ATR(14) and a target at 4.0 times ATR(14).

TrendLong & shortSwingS&P 5004 hours
n/aProfit factor
1,293Net profit EUR
22.04%Win rate
1,148Trades
-1,263Max drawdown
1.13Avg trade

Best run of 8. S&P 500, 4 hours, spread 1, from run sweeps:2026-10-04-USA500-4h-opt.tsv:77.

Entry rules, long

  1. The MACD line, MACD(12,26,9), is above its 9-period signal line on that bar.
  2. The buy order is placed on the next bar, only when no long position is open.

Entry rules, short

  1. The MACD line, MACD(12,26,9), is below its 9-period signal line on that bar.
  2. The sell short order is placed on the next bar, only when no short position is open.

Exit rules

  1. A profit target is set at 4.0 times ATR(14) from the fill price.
  2. An opposite signal closes the trade and reverses it.

Test conditions

PeriodUp to 2026-10-04
InstrumentS&P 500, 4 hours
Spread1 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
S&P 500Best run4 hoursn/a 1,14822.041,293 EUR-1,263
Nikkei 225Dailyn/a 39326.7223,184 USD-10,382
Dow Jones4 hoursn/a 36226.809,915 EUR-5,786
Nasdaq 100Dailyn/a 39520.519,311 EUR-3,644
Dow JonesDailyn/a 52021.546,452 EUR-5,654
DAX 40Dailyn/a 50623.525,678 EUR-2,740
Nasdaq 1004 hoursn/a 1,14019.743,486 EUR-3,299
GoldDailyn/a 49623.791,243 EUR-555

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// EMA Crossover With MACD Filter (long and short)
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

emafast = ExponentialAverage[9](close)
emaslow = ExponentialAverage[21](close)
myRsi = RSI[14](close)
myAtr = AverageTrueRange[14](close)
myMacd = MACDline[12,26,9](close)
macdsig = ExponentialAverage[9](myMacd)

20 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

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

Questions

About this strategy

Can I run EMA Crossover With MACD Filter (long and short) 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 8 market and timeframe combinations. The best run by trade count was S&P 500, 4 hours, with 1,148 trades.

How large was the drawdown?

The best run had a maximum drawdown of 1,263 EUR at the tested position size, against a net result of 1,293 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 Sign With EMA Alignment

Best run on the same market, S&P 500.

1.23 PF · 1,253 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.

Copy trading on US indices is available to ProRealAlgos members as spots open.

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