How to Create and Edit an MT5 Expert Advisor (2026): Wizard, Code, or No-Code

Create or edit an Expert Advisor in MetaTrader 5: MQL5 Wizard, MetaEditor coding, or no-code Strategy Builder (with optional Tactix AI step help). Compile, test in Strategy Tester, and attach to a chart.

📖 7 min read

📝 1,243 words

🏷️ MQL5 and Expert Advisors

Share this article:

How to Create and Edit an MT5 Expert Advisor (2026)

Short answer: To create an Expert Advisor in MetaTrader 5, use the MQL5 Wizard in MetaEditor (no code), write MQL5 from a template, or design visually and export MQL5. To edit an EA, open its .mq5 file, change logic or inputs, recompile (F7), and attach the new .ex5 to a chart. Always enable AutoTrading and test in Strategy Tester before live trading.

This guide maps three proven paths aligned with MetaTrader 5 algorithmic trading documentation [1] and the MQL5 language reference [2] — so you can choose what fits your time, skills, and goals.


Choose Your Path: Wizard, Code, or No-Code

PathBest forYou write MQL5?Typical time to first test
MQL5 WizardBeginners who want a rule-based EA fastNo (generated)30–60 minutes
MetaEditor (template)Full control, learning, custom logicYes1–3 days (with tutorials)
No-code builder + exportVisual thinkers, repeatable strategiesNo (export)1–2 hours

If you are unsure, start with the Wizard or no-code path to see an EA run in Strategy Tester, then move to hand-coded MQL5 when you need logic the Wizard cannot express.


Create an EA with the MQL5 Wizard

MetaTrader 5 includes a MQL5 Wizard that generates Expert Advisor source code from your choices (signals, money management, trailing). MetaQuotes describes it in Creating Expert Advisors in the MQL Wizard [3]: traders without programming skills can select indicators and modules, and the Wizard produces compilable code.

Steps (official workflow)

  1. Open MetaEditor — In MT5: Tools → MetaQuotes Language Editor, or press F4.
  2. New file — File → New (or Ctrl+N) → choose Expert Advisor (generate) → Next.
  3. Name your EA — e.g. MyFirstWizardEA → Next.
  4. Select signals — Pick modules (e.g. moving average, RSI) and configure periods per the Wizard screens.
  5. Money management & trailing — Set lot rules or accept defaults → Finish.
  6. Compile — Press F7; fix any errors until 0 errors in the Build tab.
  7. Run in MT5 — In Navigator → Expert Advisors, drag the EA onto a chart → allow Algo Trading → enable AutoTrading.

For a walkthrough with screenshots and signal combinations, see MQL5 Wizard for Dummies [4] on MQL5.com.

Limitation: Wizard EAs follow predefined modules. For custom filters, hand-code in MQL5 or use a visual builder that exports structured MQL5 (one timeframe per strategy today; multi-timeframe rules still need hand-written code). Compare paths in MQL5 Wizard vs Strategy Builder.


Create or Edit EA Code in MetaEditor

Hand-written MQL5 gives maximum flexibility. The MQL5 Reference [2] is the authoritative API documentation; Build Your First EA walks through a complete MA crossover example.

Create from template

  1. MetaEditor → File → New → Expert Advisor (template) → name → Finish.
  2. You receive OnInit(), OnDeinit(), OnTick() — the standard event model described in Expert Advisors [5].
  3. Add input parameters (lot size, periods, magic number).
  4. Implement signals and call OrderSend() or the CTrade class — see our MQL5 programming reference.
  5. Compile (F7) → attach .ex5 to chart.

A classic beginner walkthrough: Step-by-Step Guide to writing an Expert Advisor in MQL5 for Beginners [6].

Edit an existing EA

  1. Locate the .mq5 file under MQL5/Experts/ (or your broker folder).
  2. Open in MetaEditor; change inputs, conditions, or risk rules.
  3. Recompile; MT5 loads the new .ex5 when you re-attach or refresh.
  4. Version control: rename or backup before large edits — compare behavior in Strategy Tester.

Pair edits with EA risk management (position size, SL/TP) before going live.


Build an EA Without Writing MQL5

A visual strategy builder lets you define indicators, entry/exit rules, and risk in a form-based UI, then export production-ready MQL5. That fits traders who want automation without maintaining thousands of lines of code. On AlfaTactix, Tactix AI can help fill those Strategy Builder steps in plain language — it is not a raw ChatGPT MQL5 dump into MetaEditor.

Workflow:

  1. Define strategy logic (timeframes, buy/sell rules, filters) — try the demo first.
  2. Create a free account when you want to save, then export MQL5 from Code Generator.
  3. Compile in MetaEditor (or use exported package).
  4. Backtest in Strategy Tester → Demo → optional VPS for 24/7.

Read the full tour in Build an MT5 EA Without Coding.


How to Edit an Existing Expert Advisor

Source of EAHow to edit
Wizard-generatedEdit .mq5 in MetaEditor; avoid re-running Wizard on same file (overwrites).
Downloaded (.ex5 only)You need the .mq5 source; without it, only inputs exposed as EA properties are changeable.
No-code exportChange rules in the builder → re-export → recompile.
Commercial EAOnly if vendor provides source or editable inputs; respect license terms.

After any edit: compile → backtest → Demo — same discipline as a new EA.


Test, Compile, and Validate Before Live

MetaQuotes and industry best practice: never skip historical testing.

  1. Compile — 0 errors in MetaEditor (setup guide).
  2. Strategy Tester — Realistic spread, correct symbol, sufficient history (backtest guide).
  3. Demo account — Forward behavior with live ticks.
  4. Live — Small size; monitor Journal and common errors.


Tactix AI — Studio vs Guide

Tactix AI is AlfaTactix’s product assistant brand (open Tactix AI).

  • Tactix Studio turns a one-sentence strategy description into a draft across Timeframe, Signals, Filters, and Risk in the visual Strategy Builder. You review and edit every field before Code Generator writes MQL5 or Pine Script.
  • Tactix Guide explains the step you are on — what to fill, what a control means, or how to phrase a rule — without dumping untested source code.

That is form-first automation: the LLM never replaces Code Generator, and you keep plan limits and real-time validation.

Next Steps

References: MetaTrader 5 — How to Create an Expert Advisor [1], MQL5 Documentation [2], MQL5 Wizard (article) [4], Expert Advisor template (book) [3].

Frequently Asked Questions

You have three main options: use the built-in MQL5 Wizard in MetaEditor (no coding), write or edit MQL5 in MetaEditor from a template, or design rules visually and export MQL5 from a no-code builder. All paths end with a compiled .ex5 file attached to a chart with AutoTrading enabled. See the official MetaTrader 5 algorithmic trading help.

Yes. Open the .mq5 source in MetaEditor, change inputs or logic, press F7 to compile, then re-attach the updated .ex5 to your chart. If you used a wizard-generated EA, keep a copy of the source — re-running the wizard overwrites the file. For visual builders, edit the strategy and re-export MQL5.

No — you can run EAs built by the Wizard or downloaded from the Market. To customize logic deeply, MQL5 helps. Our MQL5 environment setup and programming reference support the coding path.

For a quick prototype: MQL5 Wizard or a no-code workflow. On AlfaTactix, try the Strategy Builder demo and optionally Tactix AI to fill signals, filters, and risk in plain language — then create a free account to save and export. For learning structure: follow Build Your First EA after environment setup. Always validate in Strategy Tester before live trading.

Check AutoTrading is on, the EA smile icon is active, the correct .ex5 is on the chart, and the Journal for errors. See MT5 Error 10016 and Common MQL5 EA Errors.

References

  1. MetaQuotes, MetaTrader 5 Help. How to Create an Expert Advisor or an Indicator. https://www.metatrader5.com/en/terminal/help/algotrading/autotrading
  2. MetaQuotes, MQL5 Reference. MQL5 Reference. https://www.mql5.com/en/docs
  3. MetaQuotes, MQL5 Programming for Traders. Creating Expert Advisors in the MQL Wizard. https://www.mql5.com/en/book/automation/experts/experts_wizard
  4. MQL5 Articles. MQL5 Wizard for Dummies. https://www.mql5.com/en/articles/287
  5. MetaQuotes, MQL5 Reference. Client Terminal Events. https://www.mql5.com/en/docs/runtime/event_fire
  6. MQL5 Articles. Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners. https://www.mql5.com/en/articles/100

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.