On this page
Back to tutorials

ADX Trend EA MT5 — No Code

ADX > 25 plus DMI diCross for trend direction: ADX and DMI parameters, AND logic on Step 3, export MQL5, Strategy Tester workflow.

📖 15 min read

📝 3,000 words

🏷️ MQL5 & Expert Advisors

Share this article:

Try the workflow from this guide

Open the live demo first — no signup. Sign up later to save your strategy and export from Code Generator.


ADX Trend-Following EA for MT5 — No Code

Quick Answer: ADX Trend EA Without Code

Quick answer: On Step 3 — Signals in AlfaTactix Strategy Builder, add ADX and DMI (both available in the indicator list). Buy (AND): ADXCompare → Operator >, Value 25 · DMIdiCross → Direction Up. Sell (AND): ADXCompare>, 25 · DMIdiCross → Direction Down. Set ADX Length 14, Threshold 25, DMI Length 14. Risk on Step 5 → Save → export MQL5 from Code Generator → backtest H1 EURUSD with Every tick.

Disclosure: Educational guide — not financial advice.

Related guides: ADX Indicator (academy) · DMI Indicator · Supertrend EA — No Code · MA Crossover EA — No Code · Advanced MTF & Filters


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.

LayerRole
ADXFilter: only trade when trend is strong (e.g. ADX > 25)
DMIDirection: +DI vs -DI via diCross or trendDirection
SignalRule (starter)
BuyADX > 25 AND DMI diCross Up
SellADX > 25 AND DMI diCross Down

See MQL5 iADX in exported code.


Classic ADX Settings and When It Works

SettingStarter
ADX Length14
ADX Threshold25 (Compare value)
DMI Length14
TimeframeH1 or H4
SymbolEURUSD, GBPUSD

Works best: Established trends after ADX rises above 25.

Struggles in: Sideways markets — ADX below 25, whipsaw on DMI crosses. Add Step 4 session filter.

ADX academy guide · DMI academy guide.


ADX and DMI Parameters in Strategy Builder

ADX parameters

ParameterRangeDefault
Length1 – 10014
Threshold0 – 10025
Smoothingnone, sma, ema, wma, smma, vwmanone
Smoothing Length1 – 10014
Offset-50 – 500
SourceClose, High, LowClose
DirectionRising, Fallingrising

DMI parameters

ParameterRangeDefault
Length2 – 10014
SourceClose, Open, High, Lowclose
SmoothingNone, SMA, EMA, …None
Smoothing Length1 – 10014
Offset-50 – 500

ADX and DMI Condition Types Explained

ADX conditions

1. Compare — Operator + Value (use > 25 for trend strength).

2. Breakout — Direction, Threshold, Period, Confirmation, Volume Confirmation.

3. Slope — Direction (rising/falling), Period, Min Slope, Smoothing, Source.

4. Pattern — Pattern Type, Min Height, Min Width, Volume Confirmation.


DMI conditions (direction)

1. diCrossDirection Up/Down · Value (default 0) — use for this guide.

2. trendDirection — Direction · Period · Confirmation.

3. compare — Operator + Value.

4. Additional types in UI (breakout, slope, etc.) — same pattern as other indicators.

Logical combination: On Step 3, group (ADX Compare > 25) AND (DMI diCross Up) on Buy tab — see Build EA Without Coding for AND/OR groups.


Build the ADX Trend EA Step by Step

Step 1 — Name

ADX DMI Trend H1

Step 2 — Timeframes

H1 enabled.

Step 3 — Signals (Buy)

  1. Add ADX — Length 14, Threshold 25.
  2. Condition Compare> → Value 25.
  3. Add DMI — Length 14.
  4. Condition diCross → Direction Up.
  5. Combine both with AND.

Step 3 — Sell

Mirror: ADX > 25 AND DMI diCross Direction Down.

Step 4 — Filters

Market Session London/NY optional.

Step 5 — Risk

SL/TP, lot size — EA Risk Management.

Step 6 — Save


Export, Compile, and Backtest

Code Generator → compile F7Strategy Tester Every tick → Demo.

Strategy Tester vs Live.


Improvements: Filters and Risk

IssueFix
Too many DMI crossesRaise ADX Compare to 30
Late entriesAdd H4 ADX filter on Step 2 MTF
Range lossesSkip when ADX < 20 (invert Compare on filter tab)

Next Steps

Try Strategy Builder — no signup: Open the live demo.

References: MQL5 iADX · Strategy Tester.

Build this EA in Strategy Builder

Start in the live demo — no signup required. Walk through signals, filters, and risk. Create a free account only when you want to save and export MQL5.

Frequently Asked Questions

Yes. On Step 3 add ADX with Compare ADX > 25 for trend strength and DMI with diCross Direction Up for buy / Down for sell (combine with AND). Export MQL5, compile once, backtest with Every tick.

ADX measures trend strength, not direction. Pair ADX > 25 with DMI +DI/-DI logic via DMI diCross or trendDirection conditions in Strategy Builder.

Length 14 and threshold 25 are common defaults in the builder. Raise threshold (30) for fewer trades; lower (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.

ADX indicator = strength. DMI indicator = directional movement (+DI / -DI). This guide uses both on Step 3.

Try Strategy Builder — no signup

Try Strategy Builder — No Signup