Join waitlist
Strategies / Trend / MACD Trend Swing Stop

MACD Trend Swing Stop

The strategy trades MACD crossovers that agree with a 200 period EMA trend and a momentum filter. The stop sits at the 25 bar swing low or high, with a target at 1.5 times that risk.

TrendLong & shortSwingGold1 hour
1.62Profit factor
1,032Net profit EUR
46.59%Win rate
264Trades
-204Max drawdown
3.91Avg trade

Best run of 16. Gold, 1 hour, spread 0.6, from run pf:2026-10-12-GOLD-1h.tsv:1.

Entry rules, long

  1. The MACD line is below the histogram, and the histogram is above zero.
  2. The close is above the 200 period EMA.
  3. A momentum oscillator sits above its 8 period average signal line.
  4. No position is open.

Entry rules, short

  1. The MACD line is above the histogram, and the histogram is below zero.
  2. The close is below the 200 period EMA.
  3. A momentum oscillator sits below its 8 period average signal line.
  4. The choppy-market score is above 30.
  5. No position is open.

Exit rules

  1. The profit target is 1.5 times the distance from entry to that stop.

Test conditions

PeriodUp to 2026-10-12
InstrumentGold, 1 hour
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 run1 hour1.62 26446.591,032 EUR-204
Nikkei 225Dailyn/a 1573.337,552 USD-1,713
Nikkei 2254 hoursn/a 3941.035,703 USD-3,278
Nasdaq 1001 hourn/a 26138.314,866 EUR-1,339
Nasdaq 1004 hoursn/a 5341.513,329 EUR-1,362
Dow Jones4 hoursn/a 2245.452,925 EUR-1,726
Nasdaq 10010 minn/a 50938.512,813 EUR-1,098
US Crude Oil1 hourn/a 17045.882,737 EUR-1,403
Nasdaq 10030 minn/a 45438.772,692 EUR-2,540
Brent Crude1 hourn/a 11649.142,609 EUR-1,686
FTSE 1001 hourn/a 22742.731,852 EUR-568
Brent Crude4 hoursn/a 2955.171,685 EUR-680
S&P 5004 hoursn/a 5855.17905 EUR-444
Gold4 hoursn/a 5453.70663 EUR-173
S&P 50030 minn/a 40440.10520 EUR-374
S&P 5001 hourn/a 26138.31386 EUR-282

Charts

Results by run

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

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// MACD Trend Swing Stop
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 1 hour
// ==============================================================

DEFPARAM CumulateOrders = false

myMacd = ExponentialAverage[10](close) - ExponentialAverage[23](close)
signal = ExponentialAverage[10](myMacd)
hist = myMacd - signal

rocA = 100 * (close - close[10]) / close[10]
rocB = 100 * (close - close[15]) / close[15]
rocC = 100 * (close - close[20]) / close[20]
rocD = 100 * (close - close[30]) / close[30]
kst = Average[11](rocA) + 2 * Average[11](rocB) + 3 * Average[12](rocC) + 4 * Average[16](rocD)
kstsig = Average[8](kst)

ema = ExponentialAverage[200](close)

28 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

MACDEMA
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 MACD Trend Swing Stop 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 16 market and timeframe combinations. The best run was Gold, 1 hour, with a profit factor of 1.62 over 264 trades.

How large was the drawdown?

The best run had a maximum drawdown of 204 EUR at the tested position size, against a net result of 1,032 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

Moving Average Colour Shift

Also a trend strategy.

1.62 PF · 533 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