On this page
Back to tutorials

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 export. Compile, test in Strategy Tester, and attach to a chart with clear steps.

๐Ÿ“– 16 min read

๐Ÿ“ 3,100 words

๐Ÿท๏ธ MQL5 & Expert Advisors

Share this article:

Want to build a no-code strategy right now?

Create your free account in seconds and start building immediately.


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 and the MQL5 language reference โ€” 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: 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 on MQL5.com.

Limitation: Wizard EAs follow predefined modules. For unique multi-timeframe rules or custom filters, use code or a visual builder that exports structured MQL5.


Create or Edit EA Code in MetaEditor

Hand-written MQL5 gives maximum flexibility. The MQL5 Reference 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.
  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.

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.

Workflow:

  1. Define strategy logic (timeframes, buy/sell rules, filters).
  2. Export MQL5 source.
  3. Compile in MetaEditor (or use exported package).
  4. Backtest in Strategy Tester โ†’ Demo โ†’ optional VPS for 24/7.

Read the full comparison in Build an MT5 EA Without Coding. Try the Strategy Builder demo to prototype before export.


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.

Next Steps

References: MetaTrader 5 โ€” How to Create an Expert Advisor, MQL5 Documentation, MQL5 Wizard (article), Expert Advisor template (book).

Build your no-code trading strategy now โ€” free

Create your account and start building a complete no-code strategy right now. Add indicators, filters, and risk rules, then export MQL5 in minutes.

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. 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.

Build your no-code strategy now โ€” free

Create Free Account