Join waitlist
Strategies / Mean reversion / Contrarian Band Envelope Reversion

Contrarian Band Envelope Reversion

The strategy sells short when price closes above the upper Bollinger Band and an upper envelope while trend strength is low and the stochastic is above 50, and buys the mirror setup. Positions close when price moves back inside a band or stochastic crosses 50.

Mean reversionLong & shortIntradayDow Jones30 min
1.97Profit factor
8,028Net profit EUR
59.85%Win rate
137Trades
-1,931Max drawdown
58.60Avg trade

Best run of 14. Dow Jones, 30 min, spread 3, from run pf:2026-10-12-DOW30-30m.tsv:1.

Entry rules, long

  1. Trend strength is low: the 14-bar ADX is below 30.
  2. The 20-bar average of the 50-bar stochastic %K is below 50.
  3. A long position opens at market when all three conditions hold and no long position is open.

Entry rules, short

  1. Trend strength is low: the 14-bar ADX is below 30.
  2. The 20-bar average of the 50-bar stochastic %K is above 50.
  3. A short position opens at market when all three conditions hold and no short position is open.

Exit rules

  1. A long position also closes when the 20-bar stochastic average is above 50.
  2. A short position closes at market when price closes below the lower Bollinger Band or 0.99 times the 20-bar average.
  3. A short position also closes when the 20-bar stochastic average is below 50.

Test conditions

PeriodUp to 2026-10-12
InstrumentDow Jones, 30 minutes
Spread3 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
Dow JonesBest run30 min1.97 13759.858,028 EUR-1,931
EUR/USD30 minn/a 2369.5728,730 USD-2,478
Silver3 minn/a 27462.418,055 USD-6,643
Dow Jones1 hourn/a 15460.395,174 EUR-2,715
Dow Jones15 minn/a 12262.304,927 EUR-2,610
GBP/USD4 hoursn/a 21266.043,278 USD-1,941
EUR/USD10 minn/a 2100.00799 USD-11.00
FTSE 10015 minn/a 9955.56768 EUR-463
GBP/USD30 minn/a 2857.14530 USD-506
DAX 401 minn/a 366.67307 EUR-102
GBP/USD10 minn/a 475.00216 USD-122
FTSE 10010 minn/a 1963.16206 EUR-149
GBP/USD15 minn/a 757.14188 USD-167
Dow Jones1 minn/a 1100.0029.90 EUR-1.00

Charts

Results by run

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

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Contrarian Band Envelope Reversion
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Mean reversion
// Direction: Long & short
// Timeframe tested: 30 minutes
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE raw = 50

basis = Average[20](close)
dev = 2 * STD[20](close)
upper = basis + dev
lower = basis - dev
upenv = basis * 1.01
loenv = basis * 0.99
myAdx = ADX[14]
hh = Highest[50](high)
ll = Lowest[50](low)

23 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

ADXBollinger BandsSMAStochastic
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • Results include the spread only. Commissions and overnight financing are not included.

Questions

About this strategy

Can I run Contrarian Band Envelope Reversion 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 14 market and timeframe combinations. The best run was Dow Jones, 30 minutes, with a profit factor of 1.97 over 137 trades.

How large was the drawdown?

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

Turtle Trade

Best run on the same market, Dow Jones.

2.42 PF · 6,324 trades

Long EMA Filtered RSI Dip

Also a mean reversion strategy.

1.97 PF · 133 trades

See how ProRealAlgos combines strategies like this into one automated portfolio.

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