Join today
Strategies / Trend / Envelope ADX

Envelope ADX Strategy on Gold

This 1 minute scalper looks for a bar that pokes outside a 0.4% envelope around the 20 SMA and closes back inside. It enters only when ADX(40) is above 10 and the DI lines agree with the direction. Each trade has a 30 point stop and a 10 point target.

TrendLong & shortIntradayGold1 min
n/aProfit factor
2,169Net profit EUR
75.94%Win rate
715Trades
-1,257Max drawdown
3.03Avg trade

Best run of 1. Gold, 1 min, spread 0.6, from run sweeps:2026-09-17-GOLD-1m-opt.tsv:2.

Entry rules, long

  1. ADX(40) is above 10 and DI+ is above DI-
  2. Members only

Entry rules, short

  1. ADX(40) is above 10 and DI+ is below DI-
  2. Members only

Exit rules

  1. Members only
  2. Profit target 10 points

Test conditions

PeriodUp to 2026-09-17
InstrumentGold, 1 minute
Spread0.6 points
Contracts5
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-09-17

Parameters

positionSize
Shares per trade
5
bandPeriod
Envelope SMA length
20
upperFactor
Upper envelope, 0.4% above the SMA
1.004
lowerFactor
Lower envelope, 0.4% below the SMA
0.996
adxPeriod
ADX and DI length
40
adxThreshold
Minimum ADX reading
10
stopLossPoints
Protective stop in points
30
takeProfitPoints
Profit target in points
10

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run1 minn/a 71575.942,169 EUR-1,257

Charts

Results by run

Net profit against max drawdown

Net profitMax drawdown
0-2K-1K1K3KGold · 1 min

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Envelope ADX
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 1 minute
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
positionSize = 5          // shares per trade
bandPeriod = 20           // envelope SMA length
upperFactor = 1.004       // upper envelope, 0.4% above the SMA
lowerFactor = 0.996       // lower envelope, 0.4% below the SMA
adxPeriod = 40            // ADX and DI length
adxThreshold = 10         // minimum ADX reading
stopLossPoints = 30       // protective stop in points
takeProfitPoints = 10     // profit target in points

// --- Indicators ---
upperBand = Average[bandPeriod](close) * upperFactor
lowerBand = Average[bandPeriod](close) * lowerFactor
adxValue = ADX[adxPeriod]
plusDI = DIplus[adxPeriod](close)
minusDI = DIminus[adxPeriod](close)

16 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • The stop is three times the target, so a win rate of 75.94% is needed just to stay ahead of losses.
  • Average trade is EUR 3.03, so small changes in spread or slippage on 1 minute bars can wipe out the edge.
  • Only Gold on the 1 minute chart was tested, and profit factor was not recorded because only sweep data exists.

Indicators used

SMAADXDMI

How to load it

  1. Copy the code with the copy button above 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.

Questions

About this strategy

Can it run in ProOrder?

Yes. The stop and target are coded into the system, which trades 5 contracts per signal.

How did it do on Gold?

Gold 1 minute made EUR 2,168.50 over 715 trades with a 75.94% win rate. No other market was tested.

What drawdown should I plan for?

At 5 contracts the max drawdown was EUR 1,256.50, more than half the net profit. Margin depends on your broker.

Why the 1 minute chart?

The 10 point target is tiny, so the system needs fast bars to reach it quickly. The test used a 0.6 point spread, and real costs may differ.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Triple Band Market Model

Best run on the same market, Gold.

2.27 PF · 203 trades

Long-Term Moving Average Cross

Also a trend strategy.

12.31 PF · 61 trades

Scalpers need careful pairing. Join the ProRealAlgos waitlist to learn how.

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