Join waitlist
Strategies / Momentum / Median Price MACD Histogram Long

Median Price MACD Histogram Long

The strategy buys when the close is above a rising 9 period EMA of the median price and the MACD histogram turns positive. It closes the long when the mirrored bearish condition appears.

MomentumLong onlySwingS&P 500Daily
1.96Profit factor
4,586Net profit EUR
46.13%Win rate
271Trades
-1,002Max drawdown
16.92Avg trade

Best run of 31. S&P 500, Daily, spread 1, from run pf:2026-10-10-USA500-D.tsv:5.

Entry rules, long

  1. The close is above the 9 period EMA of the median price, and that EMA is rising.
  2. The close is above the previous close.

Exit rules

  1. The close is below a falling 9 period EMA of the median price and below the previous close.

Test conditions

PeriodUp to 2026-10-10
InstrumentS&P 500, Daily
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-10

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
S&P 500Best runDaily1.96 27146.134,586 EUR-1,002
Nasdaq 1004 hours1.49 45948.8016,224 EUR-3,956
Nasdaq 1001 hour1.31 1,64239.7120,277 EUR-3,454
USD/JPY4 hoursn/a 53142.94495,240 USD-304,770
USD/JPY1 hourn/a 2,05140.08405,150 USD-261,730
USD/JPY10 minn/a 3,13939.31325,450 USD-113,610
Nikkei 225Dailyn/a 19744.6745,574 USD-12,923
Silver4 hoursn/a 45140.3539,709 USD-16,194
Nikkei 2254 hoursn/a 38944.4732,499 USD-10,966
Nikkei 2251 hourn/a 1,45139.2130,591 USD-9,093
Nikkei 22510 minn/a 2,90038.6923,638 USD-15,889
Dow JonesDailyn/a 24248.7622,685 EUR-11,458
Nikkei 22530 minn/a 2,77239.4318,970 USD-14,932
DAX 40Dailyn/a 30945.9515,428 EUR-4,657
Dow Jones1 hourn/a 59540.5014,413 EUR-7,071
Dow Jones4 hoursn/a 16040.0012,603 EUR-8,671
Nasdaq 10030 minn/a 2,76938.8612,023 EUR-5,507
DAX 401 hourn/a 1,61039.9410,721 EUR-5,238
Nasdaq 100Dailyn/a 19547.189,010 EUR-6,938
Nasdaq 1005 minn/a 3,05839.679,007 EUR-2,618
GBP/USDDailyn/a 22341.268,537 USD-6,900
DAX 404 hoursn/a 46843.597,943 EUR-4,026
Dow Jones10 minn/a 3,09838.487,872 EUR-7,367
DAX 4030 minn/a 2,92239.877,677 EUR-4,335
S&P 5004 hoursn/a 46646.784,162 EUR-1,291
Gold4 hoursn/a 48443.803,238 EUR-962
GoldDailyn/a 22040.452,659 EUR-853
Gold1 hourn/a 1,78539.162,551 EUR-814
S&P 5001 hourn/a 1,68541.362,376 EUR-971
S&P 50010 minn/a 2,98836.851,327 EUR-876
Gold5 minn/a 3,15537.50920 EUR-660

Charts

Results by run

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

// ==============================================================
// Median Price MACD Histogram Long
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Momentum
// Direction: Long only
// Timeframe tested: Daily
// ==============================================================

DEFPARAM CumulateOrders = false

out = ExponentialAverage[9](MedianPrice)
myMacd = ExponentialAverage[12](MedianPrice) - ExponentialAverage[26](MedianPrice)
sig = ExponentialAverage[9](myMacd)
hist = myMacd - sig

12 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
Longer historyRe-run on up to 1,000,000 barsS&P 500 · Daily · older data 0.00 EUR

S&P 500 had no history beyond the standard run, so both runs used 14,000 bars.

S&P 500 · Daily

Bars available14,000
Net, standard 200,000-bar run4,585.60 EUR
Net, long run4,585.60 EUR
Net on the older data alone0.00 EUR
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • Results include the spread only. Commissions and overnight financing are not included.

Questions

About this strategy

Can I run Median Price MACD Histogram Long 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 31 market and timeframe combinations. The best run was S&P 500, Daily, with a profit factor of 1.96 over 271 trades.

How large was the drawdown?

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

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

1.23 PF · 1,253 trades

MACD Histogram Momentum Long

Also a momentum strategy.

1.99 PF · 308 trades

See how ProRealAlgos combines strategies like this into one automated portfolio.

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