MetaTrader Expert Advisor Permissions: A Complete Setup

Learn how to configure EA permissions in MT4 and 5 to enable automated trading, including DLL imports, signal trading, and common.

metatrader-expert-advisor-permissions-a-complete

Introduction

Every MetaTrader user who runs an Expert Advisor eventually hits the same wall: the EA loads onto the chart, the smiley face appears, but no trades execute. More often than not, the culprit is misconfigured Expert Advisor permissions. This guide walks you through every permission setting in MT4 and MT5, explains what each toggle actually controls, and shows you how to avoid the common pitfalls that stop your automated strategies from running.

By the end of this guide, you will be able to confidently configure EA permissions for any third-party or custom-built robot, understand the security implications of each setting, and diagnose permission-related failures in seconds.

Prerequisites

Before adjusting permissions, ensure you have:

  • MetaTrader 4 build 1390+ or MetaTrader 5 build 3000+ – older builds use a different permissions dialog
  • An installed Expert Advisor (.ex4 or .ex5 file) in the MQL4/Experts or MQL5/Experts folder
  • A demo or live account connected to a broker
  • Administrator rights on your PC (some permission changes require write access to the terminal folder)

Step-by-Step Instructions

1. Enabling Automated Trading Globally

Before any EA can trade, MetaTrader must have automated trading enabled at the platform level. This is the first permission gate.

  1. Open MetaTrader 4 or 5.
  2. Go to Tools → Options (or press Ctrl+O).
  3. Click the Expert Advisors tab.
  4. Check the box: "Allow Automated Trading" (MT4) or "Enable Automated Trading" (MT5).
  5. Click OK to save.

In MT4, you will also see a green triangle button on the toolbar labeled "Algo Trading". Click it so it turns green. In MT5, the same button is labeled "AutoTrading". Both must be active (not greyed out).

2. Setting Individual EA Permissions

Each EA loaded on a chart has its own permission profile. To configure it:

  1. Drag your EA from the Navigator panel onto a chart.
  2. The Expert Advisor Properties dialog opens automatically.
  3. Click the Common tab (in MT4) or General tab (in MT5).
  4. You will see the following checkboxes (MT4 version):
Setting MT4 Name MT5 Name Purpose
Allow live trading Allow live trading Allow automated trading Permits the EA to send trade orders to the server
DLL imports Allow DLL imports Allow DLL imports Enables the EA to call external Windows DLL functions
External experts Allow external experts (MT4 only) N/A Allows the EA to send trade signals to external software
Alerts Allow alerts (MT4 only) N/A Permits the EA to display alert dialog boxes

In MT5, the Common tab also includes "Allow importing of MQL5 files" (for including .mq5h files) and "Allow modification of signals" (for copy trading).

3. Configuring DLL Imports Correctly

Many advanced EAs – especially those using custom indicators, external APIs, or hardware access – require DLL imports. When you check "Allow DLL imports", a new button appears: "Import from DLL..." (MT4) or "DLL Import..." (MT5).

Click this button to open a whitelist dialog. Here you can specify exactly which DLL files the EA is allowed to call. For example:

kernel32.dll
user32.dll
MyCustomLibrary.dll

If you leave this list empty, the EA can call any DLL it requests. For security, always specify the exact DLLs your EA needs. To find which DLLs an EA uses, check its source code for #import directives:

// MQL4/MQL5 example
#import "kernel32.dll"
   int GetCurrentProcessId();
#import

4. Enabling EA Permissions in the Strategy Tester

Backtesting also respects EA permissions. When you run a test from the Strategy Tester:

  1. Open the Strategy Tester (Ctrl+R).
  2. Select your EA and set parameters.
  3. Click the Expert Properties button (the wrench icon).
  4. On the Common tab, check "Allow live trading" (even for backtests – this permits the EA to call trade functions during simulation).
  5. If your EA uses DLLs, check "Allow DLL imports" here too.

5. Permission Persistence Across Terminal Restarts

EA permissions set in the Properties dialog are stored per chart. When you close and reopen the terminal, the EA reloads with its saved permissions. However, the global "Allow Automated Trading" checkbox resets to disabled after a terminal restart in MT4 (builds before 1390). In modern builds (1390+), the setting persists. MT5 has always persisted this setting.

Tips and Best Practices from Experience

  • Always test with DLL imports disabled first. If your EA runs fine without DLLs, only enable them when you specifically need external functionality. This reduces attack surface.
  • Use the whitelist feature. Never leave the DLL import list empty. Specify only the DLLs your EA actually uses. A malicious EA could call ShellExecute from shell32.dll to run arbitrary programs.
  • Check the Experts tab in the Terminal panel (View → Terminal → Experts). After attaching an EA, look for messages like 'Expert Advisor' requires DLL imports. Check 'Allow DLL imports' in the Expert Properties. This tells you exactly which permission is missing.
  • On a VPS, always enable automated trading globally before attaching EAs. Many VPS setups have the terminal start minimized, and the AutoTrading button defaults to off. Add a startup script that sends KEY_ALT_A or uses the MQL5 TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) check in your EA.
  • For copy trading or signal subscriptions, ensure the signal provider's EA has "Allow modification of signals" enabled in MT5. Without this, your terminal won't replicate the provider's trades.

Common Mistakes and Troubleshooting

Mistake 1: The EA loads but shows "disabled" in the corner

Symptom: The EA icon on the chart has a red cross or the label says "disabled".
Fix: Click the AutoTrading button on the toolbar (green triangle) to enable global algo trading. Also verify Tools → Options → Expert Advisors → Allow Automated Trading is checked.

Mistake 2: DLL import errors in the Experts log

Symptom: Messages like Cannot load DLL 'MyLib.dll' or Error calling imported function.
Fix: First, confirm the DLL file exists in the MQL4/Libraries or MQL5/Libraries folder. Then reattach the EA, go to the Common tab, check "Allow DLL imports", and specify the exact DLL name in the whitelist. If the error persists, the DLL may require additional dependencies (like Visual C++ redistributables).

Mistake 3: EA runs in backtest but not live

Symptom: The EA executes perfectly in the Strategy Tester but does nothing on a live chart.
Fix: The Strategy Tester uses its own permission environment. Check the live chart's EA Properties → Common tab. The "Allow live trading" checkbox must be enabled. Also confirm the EA is not restricted to a specific timeframe or symbol in its input parameters.

Mistake 4: "Expert Advisor cannot be run because of missing permissions" popup

Symptom: A dialog box appears when attaching the EA.
Fix: This usually means the EA calls a function that requires a permission you haven't granted. Read the error message carefully – it will say something like "requires DLL imports". Open the EA Properties and enable the required permission. If the popup persists, the EA may have hardcoded permission checks. Contact the developer.

Summary and Next Steps

Configuring Expert Advisor permissions in MetaTrader 4 and 5 is straightforward once you understand the two-tier system: global platform settings and per-EA properties. Always enable automated trading globally first, then grant individual permissions based on each EA's requirements. Use the DLL whitelist to maintain security, and check the Experts tab log for specific error messages when things go wrong.

Your next step is to verify every EA in your portfolio has the correct permissions. Open each chart, double-click the EA icon, and review the Common tab. For EAs that use external libraries, document which DLLs they require and add them to the whitelist. With proper permissions configured, your automated trading setup will run reliably 24/7.

Frequently Asked Questions

Can I set EA permissions for all EAs at once instead of one by one?

No. MetaTrader requires you to configure permissions individually for each EA attached to a chart. The only global setting is the "Allow Automated Trading" checkbox in Tools → Options. For batch configuration, consider using a template that includes your EA with pre-set permissions, or write a script that loops through open charts and adjusts properties programmatically (though this is advanced and not recommended for security reasons).

Does enabling DLL imports make my EA a security risk?

It can, if you allow imports from untrusted DLLs. Always use the whitelist feature to restrict which DLLs the EA can call. Only enable DLL imports for EAs from developers you trust. A malicious DLL could read your account password, modify files, or execute system commands. When in doubt, run the EA on a demo account first with DLL imports enabled and monitor the Experts log for unexpected function calls.

Why does my EA work on one chart but not another with the same settings?

This usually happens when the EA has symbol-specific or timeframe-specific restrictions in its code. Check the EA's input parameters for options like "OnlyTradeOnEURUSD" or "TimeframeFilter". Also verify that the second chart has the same global AutoTrading setting enabled. If the EA uses custom symbols, confirm those symbols exist on both charts.

Do EA permissions persist when I upgrade MetaTrader?

Yes, EA permissions are stored in the chart template files (`.tpl`) and in the terminal's configuration database. Upgrading MetaTrader preserves these settings. However, after a major version upgrade (e.g., MT4 to MT5), you must reattach EAs and reconfigure permissions because the platforms use different file formats.

Community

Clap for the article and open comments only when you want to read them.

0 claps0 comments

Related articles