FXRobotEasy
EcoSystemChartsTools
AI BotsTradingBrokers
  1. Courses
  2. Automated Trading (MT5)
  3. Lesson 4
Back to CourseBack to Lesson 3
Beginner12–18 min

Lesson 4. MT5 Architecture for EAs — What Beginners Must Know

Understand how MT5 "holds" a robot: terminal/account/symbol, netting vs hedging, global AutoTrading vs chart-level attachment, magic numbers, inputs, logs/permissions, and multi-chart behavior.

You chose a robot style. Now learn how MT5 actually runs an EA, so you avoid common pitfalls.

4.1. Big Picture: Terminal → Account → Chart → EA

Understand the hierarchy before attaching any robot.

Terminal (MT5 App)
Account (demo/live; netting/hedging)
Chart A (EURUSD, M15)EA instance (inputs, magic)
Chart B (XAUUSD, H1)EA instance (inputs, magic)
  • •Terminal: the MT5 app runs your accounts, charts, and EAs.
  • •Account: login to a broker server (demo/live), with its own mode (netting/hedging) and permissions.
  • •Symbol + Timeframe: each chart is a 'view' of one symbol on one timeframe.
  • •EA on chart: each EA instance runs on a specific chart and timeframe; it listens to ticks and timer events there.
One EA file can be attached to many charts; each chart instance is independent.

4.2. Netting vs Hedging (Quick Refresher Applied to EAs)

Netting

One net position per symbol; opposite trades reduce/increase the single position. EA should manage partial closes by sending opposite orders.

Hedging

Separate long and short positions; EA must track multiple tickets and manage SL/TP per position.

Using a hedging-oriented EA on a netting account can lead to unexpected behavior (e.g., closes instead of hedges). Always check account mode.

4.3. AutoTrading, Chart Attachment, and Scope

Global AutoTrading button (toolbar)

Master switch — OFF stops all EAs from trading; ON allows EAs to trade (if chart-level permissions also allow it).

Chart-level

When attaching an EA (Navigator → Expert Advisors → drag to chart), allow "Algo trading" in the EA settings dialog; the EA runs only on that chart's symbol/timeframe.

Remove/disable per chart

Right-click chart → Expert List → remove; or uncheck "Algo trading" for that EA.

If nothing happens, check both switches: global and EA-level permissions.

4.4. Magic Number and Inputs (Distinct Instances)

Magic Number
What: An identifier the EA uses to track its own orders (so it doesn't touch your manual trades or another EA's trades).
Why: Running multiple EA instances requires unique magic numbers per instance/symbol.
Rule of thumb: Unique per EA per symbol/timeframe (e.g., 1001 for EURUSD M15, 1002 for XAUUSD H1).
Inputs (Parameters)
Where: When attaching an EA, the Inputs tab shows configurable parameters (risk %, lot mode, filters, time windows, magic number, etc.).
Save/load presets: Save to .set file, Load to reuse configurations.
Micro example: Two charts of the same EA with magic numbers 2001 and 2002 → each manages only its own positions.

4.5. Logs, Journals, Experts, and Permissions (Debug Basics)

Journal

Terminal/Toolbox → Journal

Terminal-level messages (connection, orders, errors).

Experts

Terminal/Toolbox → Experts

EA-specific messages (print logs, order results, errors like "Trade disabled" or "Invalid stops").

Common Issues
"AutoTrading disabled"→ Turn on global/EA switch.
"Trade is not allowed"→ Permissions in EA settings, markets closed, symbol trade disabled.
"Invalid stops"→ SL/TP too close to price (check symbol's stop level).
"No prices / Market closed"→ Trying to trade outside hours or no ticks.
Use logs first when something "doesn't work."

4.6. Symbols, Timeframes, and Multi-Chart Behavior

  • •Each EA instance is bound to its chart's symbol/timeframe; it won't trade other symbols unless coded for it.
  • •Multi-symbol EAs exist, but standard EAs watch only their chart's symbol.
  • •More charts/EAs = more CPU. Close unused charts.
  • •Restart behavior: when MT5 restarts, attached EAs re-load with previous inputs if AutoTrading is on and permissions allow it.
Running the same EA with the same magic on multiple charts can cause conflicts.

4.7. Practice: Attach an EA Twice with Unique Magic Numbers

Practice — 10–15 min

4.8. Quick Diagnostics Checklist

Quick Diagnostics Checklist
  • 1.Global AutoTrading ON?
  • 2.EA settings "Allow Algo trading" ON?
  • 3.Correct account mode for the EA logic (netting/hedging)?
  • 4.Unique magic numbers per instance?
  • 5.Logs show errors? (Journal/Experts)
  • 6.SL/TP not violating minimum stop levels?
  • 7.Market open? Symbol trading allowed?

Lesson 4 Quiz

Test your understanding with 3 questions. Pass with 2/3 correct.

What's Next?

You understand how MT5 hosts an EA — hierarchy, permissions, magic numbers, and logs. Next, we'll do the hands-on: install a real EA, configure it, and launch it on a demo chart.

Next: Install & Basic Configure an EA
Educational content only. Not financial advice. Trading involves risk of capital loss. Backtests and past performance do not guarantee future results.
EB
EASY Bots Academy

Master MT5 algorithmic trading with our comprehensive, practical course.

Learn

  • Course Curriculum
  • Learning Paths
  • Resources

Company

  • About Us
  • Privacy Policy
  • Terms of Service

Support

  • support@fxroboteasy.com
  • EcoSystem
  • Ai Bots

© 2026 EASY Bots Academy. All rights reserved.

Risk Warning: Trading involves risk. Past performance does not guarantee future results.