Join waitlist
Strategies / Momentum / DPO SMA Crossover With MACD Filter

DPO SMA Crossover With MACD Filter

Buys or sells when the detrended price oscillator and a fast SMA cross in the same direction, confirmed by MACD and directional movement. The stop sits 0.087% beyond the slow SMA, with exits on the opposite SMA cross and reversals on opposite signals.

MomentumLong & shortSwingUSD/JPYDaily
16.29Profit factor
1,032,210Net profit USD
1.26%Win rate
475Trades
-105,570Max drawdown
2,173Avg trade

Best run of 4. USD/JPY, Daily, spread 1, from run pf:2026-10-04-USDJPY-D.tsv:20.

Entry rules, long

  1. The 3-period SMA crosses above the 15-period SMA within the last 3 bars.
  2. At least one of these two crosses occurs on the current bar.
  3. The MACD (12, 26) line is above its 9-period signal line.
  4. +DI (14) is above -DI (14), or +DI crossed above -DI within the last 3 bars.
  5. The system is not already in a long state.

Entry rules, short

  1. The 3-period SMA crosses below the 15-period SMA within the last 3 bars.
  2. At least one of these two crosses occurs on the current bar.
  3. The MACD (12, 26) line is below its 9-period signal line.
  4. +DI (14) is below -DI (14), or +DI crossed below -DI within the last 3 bars.
  5. The system is not already in a short state.

Exit rules

  1. A short closes when the 3-period SMA crosses above the 15-period SMA, unless a long signal fires on that bar.
  2. An opposite entry signal reverses an open position.
  3. The stop loss sits at the 15-period SMA minus 0.087% of the close, set at the signal.
  4. If that level is not below the close, the stop sits 0.087% below the close instead.
  5. No profit target is set.

Test conditions

PeriodUp to 2026-10-04
InstrumentUSD/JPY, 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-04

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
USD/JPYBest runDaily16.29 4751.261,032,210 USD-105,570
Silver1 hour3.81 3,91820.88546,947 USD-38,870
Dow JonesDailyn/a 52625.1016,856 EUR-7,695
Gold4 hoursn/a 97427.31906 EUR-738

Charts

Results by run

Above 1.0 made money, below 1.0 lost money.

The code

ProBuilder code, as tested

// ==============================================================
// DPO SMA Crossover With MACD Filter
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Momentum
// Direction: Long & short
// Timeframe tested: Daily
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE state = 0
ONCE wason = 0
ONCE bsdpoup = 9999
ONCE bsdpodn = 9999
ONCE bsmaup = 9999
ONCE bsmadn = 9999
ONCE bsdiup = 9999
ONCE bsdidn = 9999

dpo = close - Average[12](close)

105 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

SMAMACDDMI
Longer historyRe-run on up to 1,000,000 barsUSD/JPY · Daily · older data 0.00 USD

USD/JPY had no history beyond the standard run, so both runs used 12,000 bars.

USD/JPY · Daily

Bars available12,000
Net, standard 200,000-bar run1,032,210.00 USD
Net, long run1,032,210.00 USD
Net on the older data alone0.00 USD
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 DPO SMA Crossover With MACD 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 4 market and timeframe combinations. The best run was USD/JPY, Daily, with a profit factor of 16.29 over 475 trades.

How large was the drawdown?

The best run had a maximum drawdown of 105,570 USD at the tested position size, against a net result of 1,032,210 USD.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Trend Surfer

Uses the same indicator.

1.04 PF · 10,813 trades

EMA 8 21 RSI Filtered Bracket

Best run on the same market, USD/JPY.

1.09 PF · 6,194 trades

Momentum RMI Reversal Long

Also a momentum strategy.

16.53 PF · 110 trades

Put your name on the ProRealAlgos waitlist to trade a tested portfolio instead of single strategies.

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