GoldLab Keltner Reversion is a mean-reversion Expert Advisor for ranging markets. It was designed for XAUUSD (Gold) and also runs on forex pairs and other CFDs. It deliberately stays out of strong trends. Every trade has a stop-loss.
How it trades
- Regime filter: new trades only while ADX is below the threshold (default 25) - the market is ranging.
- Setup: a closed bar pierces the outer Keltner band (EMA 20 +/- 1.5 x ATR) and closes back inside it.
- Confirmation: RSI at an extreme (default below 35 for buys / above 65 for sells, on this bar or the previous one) and a rejection - the bar closes in the trade direction or leaves a long wick (default at least 30% of the bar).
- Target: the middle EMA. With "track middle" on, the take-profit follows the middle line every bar. A trade is skipped if the middle line is too close compared with the stop.
- Hard stop-loss: a fixed ATR multiple (default 1.5 x ATR) from entry.
- Auto-off in trends: if ADX rises above the strong-trend level (default 35) open trades are closed, and no new trades are opened until ADX falls back below the range threshold. An optional time stop closes trades that do not reach the target within N bars.
Risk management
- Risk % per trade (default 1% of equity) - the lot is calculated from the stop distance. A fixed lot can be used instead.
- Daily loss limit (default 3% of the day-start equity).
- Maximum spread filter and optional trading hours.
- Free-margin check, broker volume limits and stop/freeze levels are respected before every order. One position at a time; works on hedging and netting accounts.
Inputs and default settings
| Group | Input | Default | Meaning |
|---|---|---|---|
| Strategy | Signal timeframe | H1 | Timeframe for the channel (chart timeframe can be anything) |
| Strategy | Middle EMA / ATR period / Band (x ATR) | 20 / 14 / 1.5 | Keltner channel |
| Strategy | RSI period / low / high | 14 / 35 / 65 | Stretch confirmation |
| Strategy | Min rejection wick % | 30 | Wick size as % of the bar range |
| Regime | ADX period / Max ADX | 14 / 25 | Trade only in ranges |
| Regime | Strong trend ADX | 35 | Close open trades above this (0 = off) |
| Stops | Stop-loss (x ATR) | 1.5 | Hard stop |
| Stops | Track middle EMA | true | Move the target with the middle line |
| Stops | Min reward/risk | 0.5 | Skip trades with too little room to the middle |
| Stops | Max bars in trade | 48 | Time stop (0 = off) |
| Position size | Risk % / Fixed lot / Max lot | 1.0 / 0 / 10 | Position sizing |
| Safety | Daily loss limit % | 3.0 | 0 = off |
| Safety | Max spread (points) | 50 | 2-digit gold scale: 100 = 1.00 USD |
| Safety | Use hours / Start / End | false / 1 / 22 | Optional server-time window |
| Safety | Magic number | 26100901 | Change it to run several copies on one symbol |
Recommended setup
- Symbol: XAUUSD (or your broker's gold symbol); also suits range-bound pairs such as EURCHF or AUDNZD. Signal timeframe: M15, M30 or H1.
- Hedging or netting accounts; low-spread accounts preferred because targets are shorter than in trend systems.
- Start on a demo account with the default 1% risk and test the settings in the Strategy Tester with your broker's data first. A VPS is recommended for 24/5 operation.
Honest notes
No martingale, no grid, no averaging - every position has a stop-loss. Mean reversion works in ranges and loses when a range breaks into a trend; the ADX filter reduces but cannot remove that risk. Trading gold, forex and CFDs is high risk and you can lose your capital. No trading system wins every trade, and past or backtested results do not guarantee future results. Only trade money you can afford to lose and always test on a demo account first.


Plan your risk before you run it
- Check the lot the EA will use for your balance and stop with the XAUUSD lot size calculator and the margin calculator.
- Compare targets and stops with the risk reward calculator.
- Best Timeframe for Gold Trading: Pros and Cons
- Risk Per Trade: the 1% Rule with Gold Examples
- Running Multiple EAs on One MT5 Account: Magic Numbers and Total Risk
- Breakout vs Trend Following vs Mean Reversion EA for XAUUSD
FAQ
Why does a mean reversion EA need an ADX filter?
Fading the edge of a channel works in ranges but loses in strong trends. The low-ADX condition keeps the EA out of trending markets, where price can ride the outer band for a long time.
Is there a free demo?
Yes. Every MQL5 Market product has a free demo that runs in the MetaTrader 5 Strategy Tester, so you can test it on your broker's own data before buying.
Does it use martingale, grid or averaging down?
No. Every position is opened with a stop-loss, the lot size comes from your risk % (or a fixed lot), and there is a daily loss limit.
Which broker and account do I need?
Any MetaTrader 5 broker that offers XAUUSD, on a hedging or netting account. A low-spread account and a VPS for 24/5 operation are recommended.
Can this EA guarantee profits?
No. No trading system wins every trade, and backtest or past results do not guarantee future results. Start on a demo account with the default risk.
Trading gold, forex and CFDs is high risk and you can lose your capital. This page is for information only and is not investment advice. Illustrations are not trading results.
