Join waitlist
Strategies / Pattern / MACD Divergence Trend Filter

MACD Divergence Trend Filter

Buys when the MACD line forms a higher low while price makes a lower low, with the MACD below zero and the 150-period EMA above the 600-period EMA. Sells short on the mirrored bearish divergence, and uses a 7% stop and a profit target.

PatternLong & shortIntradayNikkei 22515 min
n/aProfit factor
7,792Net profit USD
84.16%Win rate
442Trades
-5,931Max drawdown
17.63Avg trade

Best run of 18. Nikkei 225, 15 min, spread 10, from run sweeps:2026-10-04-NIKKEI-15m-opt.tsv:25.

Entry rules, long

  1. That MACD value is higher than the previous pivot's, while its low price is lower, with pivots 5 to 60 bars apart
  2. The MACD line has stayed below zero over the last 14 bars, and the 150-period EMA is above the 600-period EMA

Entry rules, short

  1. That MACD value is lower than the previous pivot's, while its high price is higher, with pivots 5 to 60 bars apart
  2. The MACD line has stayed above zero over the last 14 bars, and the 150-period EMA is below the 600-period EMA

Exit rules

  1. A stop loss 7% from the entry price
  2. Long target: 1.5 times the distance from the signal close to the lowest low of the last 10 bars
  3. Short target: 1.5 times the distance from the signal close to the highest high of the last 10 bars

Test conditions

PeriodUp to 2026-10-04
InstrumentNikkei 225, 15 minutes
Spread10 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
Nikkei 225Best run15 minn/a 44284.167,792 USD-5,931
Nikkei 2254 hoursn/a 5687.5014,917 USD-2,816
Nikkei 2251 hourn/a 20585.3712,366 USD-6,170
Silver4 hoursn/a 7768.839,486 USD-6,821
Nikkei 22530 minn/a 43086.749,200 USD-5,409
Nikkei 225Dailyn/a 2272.738,370 USD-3,689
Dow Jones10 minn/a 41291.026,746 EUR-4,630
Nasdaq 10030 minn/a 40986.805,115 EUR-2,767
Nasdaq 10010 minn/a 40289.804,792 EUR-3,587
Dow JonesDailyn/a 2479.174,319 EUR-1,019
DAX 404 hoursn/a 6387.303,016 EUR-2,731
FTSE 100Dailyn/a 2286.362,703 EUR-563
Brent Crude2 minn/a 41385.962,447 EUR-883
Brent Crude4 hoursn/a 4276.192,411 EUR-2,008
US Crude Oil4 hoursn/a 6178.692,399 EUR-2,017
FTSE 10010 minn/a 41286.411,209 EUR-694
S&P 500Dailyn/a 2968.97546 EUR-203
Gold4 hoursn/a 7887.18506 EUR-291

Charts

Results by run

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

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// MACD Divergence Trend Filter
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Pattern
// Direction: Long & short
// Timeframe tested: 15 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE plosc = 0
ONCE pllow = 0
ONCE plbar = -1
ONCE phosc = 0
ONCE phhigh = 0
ONCE phbar = -1

emafast = ExponentialAverage[12](close)
emaslow = ExponentialAverage[26](close)
osc = emafast - emaslow
emaa = ExponentialAverage[150](close)
emab = ExponentialAverage[600](close)

bullcond = 0
bearcond = 0

51 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
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 5,931 USD is large next to the net profit of 7,792 USD.

Questions

About this strategy

Can I run MACD Divergence Trend 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 18 market and timeframe combinations. The best run by trade count was Nikkei 225, 15 minutes, with 442 trades.

How large was the drawdown?

The best run had a maximum drawdown of 5,931 USD at the tested position size, against a net result of 7,792 USD.

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

Rock Climber

Best run on the same market, Nikkei 225.

1.44 PF · 1,644 trades

Breakout Reversal

Also a pattern strategy.

n/a PF · 459 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