Join waitlist
Strategies / Trend / MACD Crossover Volatility Stop Filter

MACD Crossover Volatility Stop Filter

The strategy buys on a bullish MACD crossover when +DI(14) is above -DI(14). It closes the long on a bearish MACD crossover with -DI(14) above +DI(14), or when the close falls below an ATR(20) volatility stop.

TrendLong onlySwingGoldDaily
3.02Profit factor
3,651Net profit EUR
38.19%Win rate
144Trades
-809Max drawdown
25.36Avg trade

Best run of 36. Gold, Daily, spread 0.6, from run pf:2026-10-04-GOLD-D.tsv:3.

Entry rules, long

  1. No trades are placed on the first 60 bars.

Exit rules

  1. Close the long when the close falls under a volatility stop set 2.0 times ATR(20) from the highest close since the trend turned up.

Test conditions

PeriodUp to 2026-10-04
InstrumentGold, Daily
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 runDaily3.02 14438.193,651 EUR-809
S&P 500Daily2.30 16940.833,765 EUR-569
Gold4 hours2.29 29338.574,048 EUR-568
DAX 40Daily1.98 17440.2317,287 EUR-3,850
Gold3 min1.21 1,91031.101,893 EUR-431
USD/JPY10 min1.18 2,02433.65469,740 USD-112,480
USD/JPY30 minn/a 1,88233.90570,100 USD-207,530
USD/JPY1 hourn/a 1,30233.79539,870 USD-421,060
EUR/USDDailyn/a 13832.6153,416 USD-39,280
EUR/USD4 hoursn/a 43934.4040,844 USD-36,463
Nikkei 225Dailyn/a 12234.4331,510 USD-15,442
SilverDailyn/a 13124.4324,322 USD-19,961
Nikkei 2254 hoursn/a 25036.4021,237 USD-10,986
Dow JonesDailyn/a 16442.6819,860 EUR-12,283
Silver15 minn/a 1,98629.6117,833 USD-9,757
Nikkei 22510 minn/a 1,92732.1216,924 USD-13,284
Dow Jones4 hoursn/a 9939.3913,398 EUR-3,595
Nasdaq 1004 hoursn/a 32747.7113,001 EUR-4,016
Nasdaq 1001 hourn/a 1,14335.5211,047 EUR-2,809
DAX 404 hoursn/a 29839.269,718 EUR-3,777
Dow Jones15 minn/a 1,66032.659,075 EUR-8,086
Nasdaq 10015 minn/a 1,91135.018,581 EUR-4,909
Nasdaq 100Dailyn/a 14543.456,966 EUR-6,348
Brent CrudeDailyn/a 6939.136,954 EUR-6,411
Nasdaq 10030 minn/a 2,02036.986,902 EUR-4,213
DAX 4015 minn/a 1,96931.896,033 EUR-4,371
Nasdaq 10010 minn/a 1,95833.555,869 EUR-4,292
Brent Crude1 hourn/a 62136.715,190 EUR-4,466
Gold5 minn/a 1,87233.282,300 EUR-644
Gold1 hourn/a 1,10933.542,094 EUR-1,059
S&P 5004 hoursn/a 33038.791,897 EUR-772
S&P 5001 hourn/a 1,19636.201,786 EUR-787
Gold30 minn/a 1,94833.681,751 EUR-1,275
Gold15 minn/a 1,97229.771,622 EUR-871
Gold10 minn/a 1,97431.411,521 EUR-839
S&P 50015 minn/a 1,96533.031,446 EUR-1,140

Charts

Results by run

Top 10 of 36 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

// ==============================================================
// MACD Crossover Volatility Stop Filter
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long only
// Timeframe tested: Daily
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE vmax = 0
ONCE vmin = 0
ONCE vup = 1
ONCE vstop = 0
ONCE vinit = 0

macdl = MACDline[12,26,9](close)
macds = ExponentialAverage[9](macdl)
myDiplus = DIplus[14](close)
myDiminus = DIminus[14](close)
atrm = AverageTrueRange[20](close) * 2.0

IF vinit = 0 THEN
    vmax = close
    vmin = close
    vinit = 1
ENDIF
vmax = MAX(vmax, close)
vmin = MIN(vmin, close)
prevup = vup
IF prevup = 1 THEN
    vstop = MAX(vstop, vmax - atrm)
ELSE
    vstop = MIN(vstop, vmin + atrm)
ENDIF

29 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

MACDDMIATR
Longer historyRe-run on up to 1,000,000 barsGold · Daily · older data 0.00 EUR

Gold had no history beyond the standard run, so both runs used 13,000 bars.

Gold · Daily

Bars available13,000
Net, standard 200,000-bar run3,651.20 EUR
Net, long run3,651.20 EUR
Net on the older data alone0.00 EUR
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 Crossover Volatility Stop Filter 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 36 market and timeframe combinations. The best run was Gold, Daily, with a profit factor of 3.02 over 144 trades.

How large was the drawdown?

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

Does it trade long, short or both?

It only takes long trades.

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

SMA Cross With Custom ADX Filter

Also a trend strategy.

3.01 PF · 145 trades

Get the full rules, the complete code and the ProRealAlgos portfolio as a member.

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