Join waitlist
Strategies / Mean reversion / EMA Band Reversion With Time Stop

EMA Band Reversion With Time Stop

The strategy buys when close moves back above a lower band built on a 20-bar EMA, and sells short at the mirror upper band. Longs exit when close rises above the EMA or more than 20 bars have passed since the last buy signal.

Mean reversionLong & shortSwingUSD/JPY4 hours
n/aProfit factor
188,470Net profit USD
65.66%Win rate
964Trades
-177,330Max drawdown
196Avg trade

Best run of 8. USD/JPY, 4 hours, spread 1, from run sweeps:2026-10-11-USDJPY-4h-opt.tsv:5.

Entry rules, long

  1. The previous close was below the lower band and the current close is back above it.

Entry rules, short

  1. The previous close was above the upper band and the current close is back below it.

Exit rules

  1. The long is also sold when more than 20 bars have passed since the last buy signal.
  2. A short is covered when close is below the EMA basis, or more than 20 bars have passed since the last short signal.

Test conditions

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

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
USD/JPYBest run4 hoursn/a 96465.66188,470 USD-177,330
Dow JonesDailyn/a 37768.9712,907 EUR-8,615
Nasdaq 1004 hoursn/a 93763.396,171 EUR-3,036
FTSE 100Dailyn/a 29168.045,166 EUR-1,946
Nasdaq 100Dailyn/a 28862.153,799 EUR-3,305
FTSE 1004 hoursn/a 81867.482,885 EUR-1,799
S&P 5004 hoursn/a 93366.882,514 EUR-847
S&P 500Dailyn/a 39770.281,689 EUR-907

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// EMA Band Reversion With Time Stop
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Mean reversion
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE lastbuy = -1
ONCE lastshort = -1

basis = ExponentialAverage[20](close)
sumsqr = 0
FOR myI = 0 TO 19 DO
    sumsqr = sumsqr + SQUARE(close[myI] - basis)
NEXT
dev = 2 * SQRT(sumsqr / 20)
upper = basis + dev
lower = basis - dev

27 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

EMABollinger BandsStandard Deviation
Read this firstKnown weaknesses3 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 177,330 USD is large next to the net profit of 188,470 USD.
  • 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 Band Reversion With Time Stop 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 8 market and timeframe combinations. The best run by trade count was USD/JPY, 4 hours, with 964 trades.

How large was the drawdown?

The best run had a maximum drawdown of 177,330 USD at the tested position size, against a net result of 188,470 USD.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Reversal Pattern With Chaikin Volatility

Uses the same indicator.

2.26 PF · 6,872 trades

Trend Surfer

Best run on the same market, USD/JPY.

1.04 PF · 10,813 trades

ATR Band

Also a mean reversion strategy.

10.31 PF · 53 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