Devils Advocate MT5
- Experts
-
Kelvin Kioko Kaambi
My name is Kelvin Kaambi. I've spent four years trading systematic mechanical strategies, and the past year automating them for MetaTrader 5, with a focus on XAUUSD. - Version: 1.191
- Updated: 20 September 2026
- Activations: 10
Devils Advocate
SIGNAL (Vantage) : https://www.mql5.com/en/signals/2392542
Recommended Brokers: Vantage Markets Raw ECN and VT Markets ECN
Grid trading is widely frowned upon by professional traders, and often for good reason. With Devils Advocate, I'm deliberately playing devil's advocate against the pros. I set out to prove that a grid system, designed with discipline and the right protections, can have a genuine edge. I built it as a trend-following grid Expert Advisor exclusively for XAUUSD, pairing a trend-aware engine with multiple layers of capital protection so it trades with gold's momentum instead of fighting it.
Key Features
- Fully automated trend-following grid trading for XAUUSD
- No Martingale on default settings
- Optional Adaptive Martingale with conservative lot scaling
- Multiple risk management modes
- Margin Level Protection with user-defined close-out levels
- Percentage drawdown limits
- Friday close to avoid weekend exposure
- Built-in high-impact news filter (FOMC, NFP & CPI)
Why I Built a Trend-Following Grid
Most grid EAs rely on mean reversion. They add positions as price moves against them, betting that it will snap back. On XAUUSD, that assumption is often punished. XAUUSD is known for strong, sustained directional moves, and mean reversion grids can find themselves stacking positions against a trend. I took the opposite approach. Devils Advocate first determines the prevailing trend direction and trades in the direction of the trend, betting that the trend is likely to continue rather than revert to a some sort of a mean.
How It Works
I designed Devils Advocate to combine 29 indicators across multiple timeframes and only trade when they agree. Five moving averages of different types track trend alignment from short to higher timeframes, while adaptive averages (AMA, DEMA, TEMA, FrAMA, VIDyA) catch trends early and filter out noise. Parabolic SAR, Ichimoku, Alligator and ADX confirm trend structure and strength. Bollinger Bands, Envelopes, ATR and Standard Deviation gauge volatility, while RSI, Stochastic, CCI, MACD, OsMA, Momentum, Williams %R, MFI and Force Index confirm momentum and participation.
How I Developed It (Concerns About Overfitting)
Twenty-nine indicators invites an obvious objection: with that many degrees of freedom, you can fit almost any historical series and produce an equity curve that describes the past beautifully and predicts nothing. The dev work methodology answers that objection.
Parameters were established on a defined in-sample window, a result that carries no evidential weight on its own. The meaningful test was the out-of-sample period that followed, with those parameters held fixed and no further tuning permitted. An over-specified model degrades sharply at exactly that boundary. This one didn't, which is the only reason development continued.
From there came the standard robustness work:
- Parameter sensitivity analysis. A viable parameter set sits on a plateau, not a spike. Performance had to degrade gradually as inputs were perturbed, not collapse.
- Walk-forward analysis. Rolling optimization and validation windows advanced across the history, testing whether the edge persists as markets evolve rather than whether it existed once.
- Monte Carlo simulation. Trade sequences randomized across thousands of iterations to establish the distribution of outcomes rather than the single historical path. The tail is what matters: worst-case drawdown and probability of ruin, which informed the minimum deposit and risk settings shipped with the EA.
- Execution stress testing. Spread, slippage and commission assumptions widened well beyond typical broker conditions, to confirm the edge doesn't depend on idealized fills.
- Regime segmentation. Trending, ranging and high-volatility periods examined separately, so aggregate results weren't concealing a strategy that only works in one market state.
- 2026 incubation. The 2026 data was excluded from every stage above and never used for fitting or validation. The EA instead ran on a demo account through the entire year in real time, under live spreads and genuine execution, against price action with no representation in its development history.
The results held. I'm confident it's ready for live deployment. Time will be the judge.
Risk Management
I built in multiple risk modes to suit both conservative and more aggressive trading styles. By default, no martingale is used. For traders who want faster basket recovery, the optional Adaptive Martingale can be enabled. Unlike traditional martingale systems that double lot sizes, it applies conservative multipliers across grid layers, keeping exposure growth controlled.
Capital protection works at several levels. Percentage drawdown limits cap how much of the account any basket can put at risk. Most importantly, the Margin Level Protection system continuously monitors your margin level and closes all positions if it falls to 150%, or any other level you set, well before a broker margin call. The Friday close feature shuts down trading before the weekend so baskets aren't exposed to weekend gaps, and the news filter avoids trading on FOMC rate decision, NFP, and CPI days.
Setup Requirements
- Instrument: XAUUSD (Gold)
- Timeframe: M15
- Minimum Deposit: $750
- Leverage: 1:400 or higher
- Account Mode: Hedging
- VPS: 24/7 VPS required. As a grid EA, Devils Advocate must stay connected at all times to manage open baskets and its protection systems. Downtime is riskier for grid strategies than for most other EAs.
Recommended Brokers
All development work on Devils Advocate was done using Vantage Markets Raw ECN and VT Markets ECN accounts. The historical data used for training and optimization, as well as the parameter sensitivity analysis, came from those two feeds. For that reason, those are the brokers I recommend.
Devils Advocate will run on any broker offering raw spreads, but it is specifically optimized around the spread, execution and pricing characteristics of Vantage Markets and VT Markets. Gold pricing and execution quality differ meaningfully between brokers, and a strategy tuned on one feed may not behave identically on another.
These are recommendations, not requirements. If you trade with a different broker, backtest extensively on your own feed and compare the results against Vantage and VT Markets. That comparison will show you whether there is any meaningful difference or trade-off on your side, and it's worth doing before you commit real capital.
How to Use
- Enable Algo Trading in MT5.
- Attach Devils Advocate to an XAUUSD M15 chart.
- Select your preferred Risk Mode and decide whether to enable Adaptive Martingale.
- Set your Margin Level Protection and drawdown limits.
- Leave remaining settings on default unless customization is required.
Recommended Practices
- Backtest thoroughly before going live. I strongly recommend running comprehensive backtests in the MT5 Strategy Tester using "Every tick based on real ticks" mode. Watch how baskets are built and closed, how drawdowns develop, and how the protection systems respond in different market conditions, so you know what to expect before real money is involved.
- Run it in its own account. Grid EAs carry a different risk profile from other strategies and should be kept in a separate portfolio. I recommend opening a dedicated account and running Devils Advocate alone, without other EAs or manual trades. Margin Level Protection and drawdown limits are calculated on the whole account, so other positions can distort them, and a protective close-out may also close trades that aren't Devils Advocate's.
- Attach to one chart only. Running multiple instances on the same account multiplies exposure beyond what I designed the risk settings for.
- Start conservatively. Begin with default settings and Adaptive Martingale disabled until you're familiar with how the EA builds and closes baskets.
- Don't interfere with open baskets. Avoid manually closing individual grid positions, changing settings, or restarting the EA while a basket is open, as this can disrupt basket management.
- Use a low-spread account. Grids open multiple positions, so spreads and commissions add up quickly. I strongly recommend a raw spread or ECN account.
- Withdraw profits regularly. Periodically taking profits out of the account locks in gains and limits how much capital is ever exposed.
- Only trade capital you can afford to lose. Size your account for the risk of a grid strategy, not for its best months.
Disclaimer: Devils Advocate is provided on an "as-is" and "as-available" basis without any express or implied warranty, including warranties of profitability or fitness for a particular purpose. Grid strategies carry specific risks, including the possibility of large drawdowns during extended adverse moves. Trading Forex and CFDs involves substantial risk and may result in the loss of your invested capital. Past performance from live trading, demo incubation, backtests, or strategy tester results does not guarantee future performance. I accept no liability for financial losses, broker execution issues, slippage, VPS downtime, connectivity failures, or any damages arising from the use of this software. By purchasing and using Devils Advocate, you accept full responsibility for your trading decisions and compliance with the laws and regulations applicable in your jurisdiction.
