Join waitlist
Strategies / Trend / Reversal With Deviation Stop Filter

Reversal With Deviation Stop Filter

Buys when a reversal pattern on closing prices and a close above a volatility-based stop level both point up, and sells short when both point down. Positions are closed when the two signals disagree.

TrendLong & shortSwingGold4 hours
n/aProfit factor
1,262Net profit EUR
30.33%Win rate
1,220Trades
-974Max drawdown
1.03Avg trade

Best run of 3. Gold, 4 hours, spread 0.6, from run sweeps:2026-10-11-GOLD-4h-opt.tsv:109.

Entry rules, long

  1. Stop state is +1 when the close is above the stop level, and -1 when it is below.
  2. The stop uses 20-bar extremes of a volatility band based on 2-bar ranges and a 30-bar average true range.
  3. The system buys one contract at market when both states are +1.

Entry rules, short

  1. Stop state is -1 when the close is below the stop level.
  2. The system sells short one contract at market when both states are -1.

Exit rules

  1. A short closes when the close is at or above the stop level.
  2. A position also closes when the reversal and stop states disagree.

Test conditions

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

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run4 hoursn/a 1,22030.331,262 EUR-974
USD/JPYDailyn/a 66328.661,751,490 USD-494,900
Silver4 hoursn/a 1,21929.0430,398 USD-10,944

Charts

Results by run

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Reversal With Deviation Stop Filter
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE posrev = 0
ONCE sincebad = 1000
ONCE postwo = 0
ONCE rwh = 0
ONCE rwl = 0

ll = lowest[14](low)
hh = highest[14](high)

62 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

ATRSMAStandard DeviationStochasticWMA
Read this firstKnown weaknesses2 points
  • No profit factor is available, because only sweep results exist for this strategy.
  • The maximum drawdown of 974 EUR is large next to the net profit of 1,262 EUR.

Questions

About this strategy

Can I run Reversal With Deviation Stop 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 3 market and timeframe combinations. The best run by trade count was Gold, 4 hours, with 1,220 trades.

How large was the drawdown?

The best run had a maximum drawdown of 974 EUR at the tested position size, against a net result of 1,262 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

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