ADX Trend-Following EA for MT5 — No Code
Can I build an ADX trend-following EA for MT5 without coding?
Not in AlfaTactix today. ADX and DMI are not among the indicators the MT5 Strategy Builder supports, so you cannot add them as Step 3 conditions. Two honest paths:
- Code the rule in MQL5 — one iADX handle gives you ADX, +DI and -DI (outline below).
- Build a no-code trend EA with supported indicators — for example an EMA or SMA crossover. It follows trends, but it has no trend-strength gate like ADX, so it is a different system.
Disclosure: Educational guide — not financial advice.
Related guides: ADX Indicator (academy) · DMI Indicator · MA Crossover EA — No Code · Build EA Without Coding · EA Strategy Library
What Is an ADX Trend-Following EA?
ADX (Average Directional Index) measures how strong a trend is — typically 0–100. It does not tell you up vs down by itself.
| Part | Role |
|---|---|
| ADX | Filter: only trade when trend is strong (e.g. ADX > 25) |
| +DI / -DI | Direction: +DI above -DI is bullish, -DI above +DI is bearish |
| Signal | Rule (starter) |
|---|---|
| Buy | ADX > 25 AND +DI crosses above -DI |
| Sell | ADX > 25 AND -DI crosses above +DI |
In MQL5, one iADX [1] handle returns all three lines.
Classic ADX Settings and When It Works
| Setting | Starter |
|---|---|
| ADX Period | 14 |
| ADX Threshold | 25 |
| Timeframe | H1 or H4 |
| Symbol | EURUSD, GBPUSD |
Works best: Established trends after ADX rises above 25.
Struggles in: Sideways markets — ADX below 25, whipsaw on +DI / -DI crosses. Restricting trading to liquid sessions helps.
ADX academy guide · DMI academy guide.
ADX and DMI in MQL5
A hand-written EA needs one handle and three buffers:
| Buffer | Line |
|---|---|
| 0 | ADX (MAIN_LINE) |
| 1 | +DI (PLUSDI_LINE) |
| 2 | -DI (MINUSDI_LINE) |
// OnInit
adxHandle = iADX(_Symbol, PERIOD_H1, 14);
// OnTick, once per new bar: read the last two closed bars
CopyBuffer(adxHandle, 0, 1, 2, adx); // index 0 = older bar, 1 = last closed bar
CopyBuffer(adxHandle, 1, 1, 2, plusDi);
CopyBuffer(adxHandle, 2, 1, 2, minusDi);
bool strong = adx[1] > 25.0;
bool buyCross = plusDi[0] <= minusDi[0] && plusDi[1] > minusDi[1];
bool sellCross = minusDi[0] <= plusDi[0] && minusDi[1] > plusDi[1];
Read the values with CopyBuffer [2] on closed bars only, so the signal does not change while the current bar is still forming.
A No-Code Trend EA With Supported Indicators
The MT5 form supports the market's most-used indicators: RSI, SMA, EMA, WMA, MACD, Stochastic, Williams %R, CCI, Momentum, Bollinger Bands, ATR, Volume and OBV. The closest no-code trend EA is an EMA or SMA crossover on Step 3, with an optional market session filter on Step 4 and a stop loss on Step 5 — see MA Crossover EA — No Code.
Honest limit: none of the supported indicators measures trend strength the way ADX does. ATR measures volatility, not direction or trend strength, so it is not an ADX substitute.
Compile and Backtest
Compile your .mq5 (hand-written, or exported from Code Generator for the supported-indicator version) with F7 → Strategy Tester Every tick [3] → Demo.
Improvements: Filters and Risk
| Issue | Fix |
|---|---|
| Too many +DI / -DI crosses | Raise the ADX threshold to 30 |
| Late entries | Read ADX from a higher timeframe in your own code, or lower the period |
| Range losses | Skip entries when ADX is < 20 |
Tactix AI on this workflow
AlfaTactix includes Tactix AI: use Tactix Studio to describe your idea in plain language and draft timeframes, signals, filters, and risk into the same six-step Strategy Builder form — or open Tactix Guide on any step when you only need a field explained. Review every value, then export MQL5 or Pine Script from Code Generator (form-first — not untested prompt-to-code).
Next Steps
- MA Crossover EA — No Code — a trend EA you can build today with supported indicators
- MACD + RSI Confluence
- Build EA Without Coding
References: MQL5 iADX [1] · CopyBuffer [2] · Strategy Tester [3].

