ADX Trend EA MT5 — No Code

ADX > 25 plus a +DI / -DI cross: classic settings, the iADX buffers in MQL5, and a no-code trend alternative with supported indicators.

📖 4 min read

📝 763 words

🏷️ MQL5 and Expert Advisors

Share this article:

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:

  1. Code the rule in MQL5 — one iADX handle gives you ADX, +DI and -DI (outline below).
  2. 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.

PartRole
ADXFilter: only trade when trend is strong (e.g. ADX > 25)
+DI / -DIDirection: +DI above -DI is bullish, -DI above +DI is bearish
SignalRule (starter)
BuyADX > 25 AND +DI crosses above -DI
SellADX > 25 AND -DI crosses above +DI

In MQL5, one iADX [1] handle returns all three lines.


Classic ADX Settings and When It Works

SettingStarter
ADX Period14
ADX Threshold25
TimeframeH1 or H4
SymbolEURUSD, 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:

BufferLine
0ADX (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.

Strategy Tester vs Live.


Improvements: Filters and Risk

IssueFix
Too many +DI / -DI crossesRaise the ADX threshold to 30
Late entriesRead ADX from a higher timeframe in your own code, or lower the period
Range lossesSkip 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

References: MQL5 iADX [1] · CopyBuffer [2] · Strategy Tester [3].

Frequently Asked Questions

Not in AlfaTactix today. ADX and DMI are not among the indicators the MT5 Strategy Builder supports. You can code the rule in MQL5 with iADX (ADX above 25 and a +DI / -DI cross), or build a no-code trend EA with supported indicators such as an EMA or SMA crossover.

ADX measures trend strength, not direction. Direction comes from +DI and -DI: +DI above -DI is bullish, -DI above +DI is bearish. In MQL5, iADX returns all three lines from one handle.

Period 14 and threshold 25 are common starting values. Raise the threshold (30) for fewer trades; lower it (20) for more signals in choppy markets.

No. Educational template only. ADX filters reduce trades in ranges but do not eliminate losses. Backtest and Demo on your broker.

No. ATR (supported in the builder) measures volatility, not trend strength or direction. It can keep an EA out of very quiet markets, but it is not an ADX substitute.

References

  1. MetaQuotes, MQL5 Reference. iADX. https://www.mql5.com/en/docs/indicators/iadx
  2. MetaQuotes, MQL5 Reference. CopyBuffer. https://www.mql5.com/en/docs/series/copybuffer
  3. MetaQuotes. MetaTrader 5 Built-in Trading Strategy Tester. https://www.metatrader5.com/en/automated-trading/strategy-tester

AlfaTactix is a no-code strategy builder for MetaTrader 5 (MQL5) and TradingView (Pine Script) traders who design and manage rule-based strategies.

Trading involves substantial risk of loss. AlfaTactix generates code from the rules you define and does not provide financial advice. Past or backtested performance does not guarantee future results.

© 2026 AlfaTactix. All rights reserved.