RockGlobal
Real developer desk with generic code on one monitor, a trading terminal on another, printed test checklist and notebook

Expert Advisors, MQL4 and MQL5

Understand how Expert Advisors, indicators and scripts differ, why MQL4 and MQL5 are separate environments, and what safe automation oversight requires.

Key takeaways

In briefKey takeaways
  • An Expert Advisor is a program that can react to events and, when permitted, send or manage trade instructions.
  • Indicators analyse data; scripts normally perform a single action; neither should be assumed to behave like an EA.
  • MQL4 and MQL5 use separate platform, code and account environments, so migration requires review and retesting.
  • Automation depends on code, settings, permissions, data, connectivity and the trading server.
  • Enabling an EA transfers execution tasks to software but does not transfer responsibility for supervision or risk.
On this page

MetaTrader supports programs that analyse data, automate repeated tasks and, in some cases, send trading instructions. The label “automated” can hide several dependencies. A robust workflow identifies the program type, source code or vendor, permissions, account, platform version and monitoring plan before it is enabled.

Program types in MetaTrader

Expert Advisors

An Expert Advisor, or EA, is attached to the trading environment and can respond to events such as new price data. Depending on its code and permissions, it can analyse conditions, create alerts, send orders or manage positions. Its behaviour is limited to the rules implemented—not the intention the user believed was implemented.

Indicators and scripts

A custom indicator calculates and displays analytical information and does not automatically trade by itself. A script is generally designed to perform one action when launched. Libraries and services can support other programs. Correctly identifying the type matters when reviewing permissions and expected lifetime.

MQL4 and MQL5 are separate

MT4 uses MQL4 and MT5 uses MQL5. The languages share concepts but differ in program structure, trading functions, position and order models, events and testing capabilities. Copying an MQL4 file into an MT5 folder does not convert it.

A migration should begin with functional requirements and code review, then compile in the target environment and test again. Account credentials, open positions, settings and chart templates also do not move automatically. See MT4 vs MT5 for the broader platform transition.

Permissions and deployment

Auto-trading controls can exist at terminal, program and account levels. An EA may appear on a chart while trade permissions are disabled, or permissions may be enabled for a program with unintended settings. Confirm the exact symbol, timeframe, input values, maximum position logic and external dependencies.

Treat third-party code as software with access to a financial workflow. Verify its origin, licence, update process and requested integrations. Never disclose account credentials or recovery information to install a tool.

Testing before live use

Compile warnings, logic errors and missing data can all change behaviour. Use controlled tests, multiple periods and realistic costs. Inspect individual trades rather than relying only on an aggregate result. Backtesting Limitations and Strategy Tester Risk explains why a favourable simulation is not a forecast.

Demo or forward observation can reveal timing, order-state and operational issues that a historical run may miss. It still cannot reproduce every live condition.

Live monitoring and failure modes

An EA may stop or behave differently because of a platform restart, lost connection, changed symbol specification, unavailable data, permission change, code exception, full disk, computer sleep or server rejection. Conversely, closing a chart or terminal should not be assumed to cancel existing server-side orders or positions.

Monitor the Experts and Journal messages, account state, open orders, positions and resource status. Define a manual stop procedure that distinguishes disabling new instructions from closing existing exposure. Read Platform Connectivity and Operational Trading Risk for the system boundary.

An automation governance checklist

  1. Document purpose, owner, version and source.
  2. Review code or independent evidence of behaviour.
  3. Record account, symbol, timeframe and input settings.
  4. Test with realistic data, costs and adverse cases.
  5. Set position, loss and exposure controls outside signal logic.
  6. Confirm permissions immediately before activation.
  7. Monitor logs and server-confirmed account state.
  8. Keep a tested disable-and-recovery procedure.
  9. Reapprove every material code or platform change.

No EA removes leverage, execution or market risk. Automation can make a process faster and more consistent, including when the underlying rule is wrong.

Useful answers

Frequently asked questions

What is an Expert Advisor?

An EA is a MetaTrader program that responds to events and can analyse conditions or, when coded and permitted, send and manage trading instructions.

Can an indicator place trades?

A custom indicator is intended for analysis and does not automatically trade by itself. An EA may read its values and make separate decisions.

Will an MQL4 EA run on MT5?

Not directly. MQL4 and MQL5 are separate environments. The program may need redesign or conversion, recompilation and complete retesting.

Does closing MetaTrader cancel EA orders?

Do not assume so. Existing orders and positions can remain on the server. Verify the account state and use an explicit cancellation or closing procedure.

Can a profitable backtest prove an EA works?

No. Results depend on data, assumptions, costs and parameter choices. Live conditions, operational failures and future markets can differ materially.

Editorial standard

Sources, context and review

  1. MQL5 ReferenceMetaQuotes — MQL5 ReferenceVerified Sep 13, 2026
  2. Expert AdvisorsMetaQuotes — MetaTrader 4 HelpVerified Sep 13, 2026
  3. Migration from MQL4MetaQuotes — MQL5 ReferenceVerified Sep 13, 2026
  4. Strategy TestingMetaQuotes — MetaTrader 5 HelpVerified Sep 13, 2026

Editorially reviewed by RG Compliance.

Important information

This material is provided for general information and education only. It does not take into account personal objectives, financial circumstances or needs, and it is not financial advice or a recommendation. CFDs are complex instruments and involve a high level of risk.

RG Global general information. Product availability and eligibility depend on the applicable RG entity, jurisdiction, account route and current approved product specification.

· Topics: Expert Advisors, MQL4, MQL5 · Level: Intermediate

Your next move

See the markets clearly. Trade them your way.

Move from market understanding to a secure account pathway with RockGlobal.