Join waitlist
Strategies / Trend / MACD Histogram With SMA Trend

MACD Histogram With SMA Trend

Buys when the MACD histogram turns from negative to positive with the MACD line above zero, a 12-period average above a 26-period average, and the close 26 bars ago above the 200-period average. Sells whenever the 26-period average is below the 200-period average.

TrendLong onlyIntradayS&P 50030 min
1.47Profit factor
2,735Net profit EUR
45.10%Win rate
408Trades
-649Max drawdown
6.70Avg trade

Best run of 40. S&P 500, 30 min, spread 1, from run pf:2026-10-04-USA500-30m.tsv:6.

Entry rules, long

  1. The MACD line is above zero
  2. The 12-period SMA is above the 26-period SMA
  3. The close 26 bars ago is above the 200-period SMA

Exit rules

  1. While the 26-period SMA is below the 200-period SMA, any open long is closed and no new buy is taken

Test conditions

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

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
S&P 500Best run30 min1.47 40845.102,735 EUR-649
USD/JPY15 minn/a 38339.43450,430 USD-148,020
USD/JPY30 minn/a 39840.70411,920 USD-172,450
USD/JPY10 minn/a 40341.19286,490 USD-196,220
USD/JPY1 hourn/a 27436.50240,960 USD-195,960
EUR/USDDailyn/a 1758.8284,779 USD-27,892
Nikkei 225Dailyn/a 2646.1541,289 USD-17,162
EUR/USD4 hoursn/a 7745.4534,000 USD-31,282
Nikkei 2254 hoursn/a 5534.5530,046 USD-8,636
Dow JonesDailyn/a 3164.5223,193 EUR-9,334
Nikkei 2251 hourn/a 19441.2421,518 USD-6,426
Silver2 minn/a 38438.5419,704 USD-10,131
Nasdaq 100Dailyn/a 2161.9019,610 EUR-5,066
Nasdaq 1004 hoursn/a 6952.1717,793 EUR-2,958
DAX 40Dailyn/a 3056.6715,537 EUR-5,221
Silver15 minn/a 40635.2214,533 USD-13,362
Nikkei 22515 minn/a 42038.8113,619 USD-10,461
Dow Jones15 minn/a 30742.0213,316 EUR-4,770
Nasdaq 10030 minn/a 41743.4111,351 EUR-3,234
Nikkei 22530 minn/a 41636.7810,235 USD-9,923
Nasdaq 1001 hourn/a 26642.868,293 EUR-3,770
DAX 401 hourn/a 22837.287,526 EUR-3,578
Nasdaq 10015 minn/a 41143.557,067 EUR-4,116
S&P 500Dailyn/a 3167.744,348 EUR-947
GoldDailyn/a 2055.003,825 EUR-1,190
S&P 5004 hoursn/a 6353.973,622 EUR-733
Brent Crude10 minn/a 40237.063,589 EUR-3,413
Nasdaq 1003 minn/a 40936.923,542 EUR-2,215
Brent Crude2 minn/a 37938.523,097 EUR-2,299
Nasdaq 1002 minn/a 40839.222,693 EUR-2,278
Gold4 hoursn/a 6145.902,542 EUR-962
Dow Jones1 minn/a 38534.552,507 EUR-1,375
FTSE 100Dailyn/a 2450.002,457 EUR-2,246
Gold5 minn/a 38139.112,353 EUR-779
Gold30 minn/a 39637.371,967 EUR-615
Gold15 minn/a 38236.131,716 EUR-908
Gold1 hourn/a 24141.911,712 EUR-1,442
Gold10 minn/a 38438.801,605 EUR-423
S&P 50015 minn/a 39541.771,271 EUR-719
S&P 5001 hourn/a 27840.291,002 EUR-770

Charts

Results by run

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

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// MACD Histogram With SMA Trend
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long only
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

myMacd = MACDline[12,26,9](close)
sig = ExponentialAverage[9](myMacd)
hist = myMacd - sig
fast = Average[12](close)
slow = Average[26](close)
trend = Average[200](close)

13 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

MACDSMAEMA
Longer historyRe-run on up to 1,000,000 barsS&P 500 · 30 min · older data -392.75 EUR

On the long run with 228,000 bars the net result was 2,342 EUR, against 2,735 EUR on the standard 200,000-bar run. The older data alone gave -393 EUR.

S&P 500 · 30 min

Bars available228,000
Net, standard 200,000-bar run2,734.58 EUR
Net, long run2,341.83 EUR
Net on the older data alone-392.75 EUR
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • On the older part of the 1,000,000-bar history it lost -393 EUR.

Questions

About this strategy

Can I run MACD Histogram With SMA Trend 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 40 market and timeframe combinations. The best run was S&P 500, 30 minutes, with a profit factor of 1.47 over 408 trades.

How large was the drawdown?

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

Does it trade long, short or both?

It only takes long trades.

Related

Strategies like this one

Trend Surfer

Uses the same indicator.

1.04 PF · 10,813 trades

CCI Sign With EMA Alignment

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

1.23 PF · 1,253 trades

EMA Crossover With ATR Risk Limits

Also a trend strategy.

1.47 PF · 230 trades

Want strategies that are already part of a live portfolio? Join the ProRealAlgos waitlist.

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