Join waitlist
Strategies / Trend / EMA Shifted Average Trend

EMA Shifted Average Trend

The strategy buys when an EMA based state and a stacked average state both turn bullish, and sells short when both turn bearish. An open position closes when the two states no longer agree.

TrendLong & shortSwingGoldDaily
n/aProfit factor
987Net profit EUR
43.36%Win rate
1,716Trades
-842Max drawdown
0.58Avg trade

Best run of 2. Gold, Daily, spread 0.6, from run sweeps:2026-10-12-GOLD-D-opt.tsv:89.

Entry rules, long

  1. The EMA state is +1 when the adjusted swing level falls below the previous close.
  2. The average state is +1 when the close is above the shifted 5-bar average, above the 8-bar average, above the 13-bar average.

Entry rules, short

  1. The EMA state is -1 when the adjusted swing level rises above the previous close.
  2. The average state is -1 when the close is below the shifted 5-bar average, below the 8-bar average, below the 13-bar average.

Exit rules

  1. An open position closes at market when the two states no longer agree.

Test conditions

PeriodUp to 2026-10-12
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-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest runDailyn/a 1,71643.36987 EUR-842
Dow JonesDailyn/a 1,69744.378,802 EUR-7,256

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// EMA Shifted Average Trend
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: Daily
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE posema = 0
ONCE posbw = 0

xa = ExponentialAverage[14](close)
nhh = max(high, high[1])
nll = min(low, low[1])

42 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

EMASMA
Read this firstKnown weaknesses3 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 842 EUR is large next to the net profit of 987 EUR.
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.

Questions

About this strategy

Can I run EMA Shifted Average 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 2 market and timeframe combinations. The best run by trade count was Gold, Daily, with 1,716 trades.

How large was the drawdown?

The best run had a maximum drawdown of 842 EUR at the tested position size, against a net result of 987 EUR.

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

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

ADX Filtered EMA Cross

Also a trend strategy.

1.15 PF · 607 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