Summary: A complete guide to fixing the common "DLL imports are not allowed" error in MT4. Covers root causes, step-by-step solutions, and a unique registry-level fix for Windows systems.




When an Expert Advisor (EA) refuses to load in MT4, the usual suspect is a pop-up about DLL imports. It's one of the most common "stuck" moments for traders, especially when moving to a new VPS or updating Windows. This guide provides a direct path to fix it, from the basic checkbox to a registry-level solution I've had to use on locked-down servers.

1. The Obvious (but often missed) Check: EA Properties


Most guides stop here, but it's the first gate. Right-click the EA in the Navigator window (Ctrl+N) and select "Properties" (or Modify). In the "Common" tab, you will find the "Allow DLL imports" checkbox. Ensure it is checked.

Many traders miss that this setting is EA-specific and not global. If you have multiple EAs, each one needs this permission enabled individually. If it’s checked and you still have the error, proceed.

2. The "Auto-Trading" Button and Terminal Settings


Sometimes the EA loads but the smiley face turns into a frown. This means the EA is attached but auto-trading is disabled.

  • Check the "Auto-Trading" button on the MT4 toolbar (it looks like a play button). It must be green.

  • Go to Tools -> Options -> Expert Advisors. Ensure "Allow automated trading" is checked.

  • Also, uncheck "Disable automated trading when the account has been changed" unless you have a specific reason to keep it. This prevents the EA from stopping if your VPS reconnects and briefly shows a zero balance.


  • 3. The Core Fix: Understanding the MT4 Security Model


    If the EA still throws a DLL error in the Experts tab (View -> Experts), you might be facing the "DLL imports are not allowed" error even with the box checked. This is where things get tricky.

    MT4 has two layers of DLL security:
    1. The User Layer (The checkbox we just clicked).
    2. The System Layer (A global setting that overrides the checkbox).

    If an EA uses complex DLLs (e.g., for database connections or advanced networking), MT4 might block it at the system level.

    Fix: Go to Tools -> Options -> Expert Advisors. Look for the section "Allow DLL imports" and make sure "Allow imports of external DLLs" is checked. This is the master switch. If this is off, no EA will work, regardless of the EA properties.

    4. The "File Access" Loop and Windows Permissions


    I encountered a persistent error on a Windows Server 2022 VPS where the EA worked on the demo account but failed on the live account. The error log showed "File access error".

    The EA was trying to write a log file to its own folder inside `MQL4\Files`. Even with DLLs allowed, MT4 restricts file operations to the `Files` folder and the `Experts` folder. However, Windows Administrator rights can interfere.

  • Solution: Right-click the MetaTrader 4 shortcut -> Properties -> Compatibility -> "Run this program as an administrator". This gives MT4 the necessary permissions to load the DLLs into memory.


  • 5. The Ultimate Fix: The Registry Edit (Dealing with Windows UC)


    Here is the 独家视角 solution. On standard Windows installations, this usually isn't necessary, but on VPS instances with high security settings (like those using Windows Server Core or strict group policies), MT4 sometimes ignores the master switch.

    MetaQuotes does not document this clearly, but MT4 reads a specific registry key to determine if it should allow DLLs via the system layer. I have resolved this by modifying the `HKEY_CURRENT_USER\Software\MetaQuotes\MetaTrader 4\Options` registry key.

    While standard support won't tell you to do this, I have found it to be the only solution when MT4 settings are grayed out or reset after restart.

  • Press `Win + R`, type `regedit`.

  • Navigate to `Computer\HKEY_CURRENT_USER\SOFTWARE\MetaQuotes\MetaTrader 4\Options`.

  • Find the value named `AllowDLLs`. If it exists and is set to `0`, change it to `1`.

  • *Note: If the value doesn't exist, you can create a new DWORD (32-bit) value named `AllowDLLs` and set it to `1`.*

  • Restart MT4.


  • Warning: This forces the master switch on. Only use this if you are confident the EA source is safe.

    6. The Dependency Check: Visual C++ Redistributable


    Sometimes the EA loads, but nothing happens. No errors, no trades. This happens when the DLL loads but fails internally.

    Most C++ based EAs require the Microsoft Visual C++ Redistributable. If it's missing, the DLL cannot initialize.
  • Check your Windows "Apps & features" for "Microsoft Visual C++ 2015-2022 Redistributable".

  • If missing, download it directly from Microsoft's official support website (learn.microsoft.com). Install the x64 version for 64-bit Windows, and the x86 version if MT4 is running in 32-bit mode (which it usually is).


  • 7. Final Verification: Check the Experts Tab


    After applying all fixes, restart MT4. Attach the EA to a chart.

  • If it loads, the smiley face appears, and the "Experts" tab shows "Expert Advisor loaded successfully", you are done.

  • If it fails with a specific error code (e.g., error 126), the issue is a missing dependency (like a specific `.dll` file missing from `MQL4\Libraries` or system32).


  • Reference:
  • MetaQuotes Official Help Center: Expert Advisors Security Settings.

  • Microsoft Learn: Visual C++ Redistributable download and troubleshooting.


  • *本文首发于FXEAR.com,原创内容,未经授权禁止转载。*