Join waitlist
Strategies / Trend / EMA Band MACD Swing Bracket

EMA Band MACD Swing Bracket

The strategy buys when the close is above a 255-period EMA band and the MACD line crosses above its signal line, and sells short on the mirror condition. Each trade sets its stop and target from the 10-bar swing low or high at entry.

TrendLong & shortIntradayGold5 min
1.26Profit factor
2,534Net profit EUR
49.92%Win rate
613Trades
-589Max drawdown
4.13Avg trade

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

Entry rules, long

  1. The MACD line (12, 26, 9) crosses above its 9-period signal line.

Entry rules, short

  1. The MACD line crosses below its 9-period signal line.

Exit rules

  1. The long target is the entry price plus the entry price minus the 10-bar lowest low times (1 minus 0.012).
  2. The short stop is the 10-bar highest high times (1 plus 0.006).
  3. The short target is the entry price minus the 10-bar highest high minus the entry price, times (1 plus 1.2).

Test conditions

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

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run5 min1.26 61349.922,534 EUR-589
USD/JPY4 hoursn/a 46453.23133,860 USD-57,840
Silver2 minn/a 76745.7622,634 USD-9,411
Nikkei 225Dailyn/a 10950.4612,656 USD-11,220
Gold15 minn/a 75247.872,147 EUR-688
Gold4 hoursn/a 21645.371,510 EUR-519
Gold10 minn/a 70947.531,364 EUR-632
S&P 500Dailyn/a 14751.021,300 EUR-1,058
Gold3 minn/a 60951.231,152 EUR-1,011
Gold1 minn/a 56453.90556 EUR-518

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// EMA Band MACD Swing Bracket
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 5 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE prevlong = 0
ONCE prevshort = 0

ema = ExponentialAverage[255](close)
myAtr = AverageTrueRange[100](close)
upper = ema + myAtr * 5
lower = ema - myAtr * 5
myMacdline = MACDline[12,26,9](close)
macdsig = ExponentialAverage[9](myMacdline)
swinglow = lowest[10](low)
swinghigh = highest[10](high)

32 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

EMAATRMACD
Read this firstKnown weaknesses2 points
  • Results include the spread only. Commissions and overnight financing are not included.
  • The code is published as it was backtested and has not been compiled again since.

Questions

About this strategy

Can I run EMA Band MACD Swing Bracket 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 10 market and timeframe combinations. The best run was Gold, 5 minutes, with a profit factor of 1.26 over 613 trades.

How large was the drawdown?

The best run had a maximum drawdown of 589 EUR at the tested position size, against a net result of 2,534 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Slow MACD Slope

Uses the same indicator.

6.80 PF · 7,305 trades

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

EMA and PMax Cross Long

Also a trend strategy.

1.26 PF · 1,302 trades

Want strategies that are already part of a live portfolio? 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