Running MetaTrader 5 on Linux with Wine: A Complete Working Setup and the X64 Regular Compile Method

28 November 2026, 07:10
Sahir Silvia
0
5

Introduction

MetaTrader 5 is a Windows program. MetaQuotes never released a Linux version of the terminal, and there is no Linux version of MetaEditor. That leaves a whole group of traders stuck. Some run Linux as their only operating system. Some have old hardware that cannot run Windows well. Some simply do not have a Windows licence and cannot pay for one. For them, the usual answer has been to give up on MT5, or to pay for a Windows VPS, or to borrow a Windows computer.

I did not accept that answer. I spent weeks working through the problem on a Linux container with 7.7 GiB of RAM and 4 virtual CPUs, using only free tools, and I have been running MetaTrader 5 on Linux since early November. The terminal opens, charts load, MetaEditor compiles, and the compiled files pass MQL5 Market validation. Three of my free products were built and published through this exact setup on 25 November 2026: Steadymove Trade Planner, Steadymove HalfTrend Pro, and Steadymove SuperTrend Pro. This article shows the whole path, including the six attempts that failed, so you can skip them.

Before I built anything, I checked whether someone had already written this up. I surveyed the MQL5 Articles published in the last six months, from 26 May to 26 November 2026. That is 881 unique articles. I searched their titles and descriptions for Wine, Linux, and related words. That search covered titles and descriptions only, not the full body of every article, and not the user blogs or the forum, so I cannot claim nothing anywhere on the site covers it. Within the titles and descriptions I searched, I found no references to Wine or running MT5 on Linux. That is what motivated me to document my own setup. The measurements and test results come from my own runs. Where I use external facts, such as release details or the article survey, I identify the source.

This is a practical article, not a theory article. You will find exact commands, exact file sizes, exact log lines, and two small teaching programs you can compile yourself. You will also find an honest list of what still does not work in my setup. I would rather tell you the limits now than let you discover them after hours of work.

Who this is for

This setup fits you if you run Linux and want to use MT5 without buying Windows, without paying for a VPS, and without borrowing a computer. It fits you if you want to develop indicators and Expert Advisors in MetaEditor and publish them on the MQL5 Market. It fits you if you are comfortable typing commands in a terminal, because the install and the compile step both happen on the command line.

It does not fit you if you need the Strategy Tester to run locally right now. In my setup the Tester never spawns a local agent, and I say so plainly in the Limitations section. It also does not fit you if you want a one click installer. This is a working setup, but it is a setup you build with your own hands.

What you need before you start

You need a Linux machine with a graphical environment. Mine is a Linux container running under a virtual display called Xvfb, and I use Wine to run the Windows programs. You need Wine, and the version matters more than anything else. That is the first thing I learned, and it cost me six failed attempts to learn it.

In my setup the Wine 11.6 build extracts to 762 MB and my MT5 install folder reached 340 MB, about 1.1 GiB together. Those are the sizes I observed, not a universal minimum. Allow extra room beyond that for logs, updates, and extra files. You need an internet connection that allows Wine to reach MetaQuotes servers. In my case the connection was blocked at first by a network permission setting, and I describe that step below. You need no Windows licence, no paid software, and no paid hosting. Everything in this article is free.

My test environment, for reference: an Ubuntu 24.04 container, glibc 2.39, 7.7 GiB of RAM, 4 virtual CPUs, no paid VPS, no Windows machine. Your machine will differ, and your numbers will differ a little. The method should still work, but expect to retest on your own setup.

One more note: Kron4ek's builds still need the normal Wine dependencies. The wow64 build avoids the usual 32-bit libraries, but it does not remove all system library requirements. My Ubuntu 24.04 environment had the required dependencies available. Check the build requirements on the Kron4ek releases page before you install on a different distribution.

The six failures

I will start with the failures, because they are the most useful part. If you search the internet for running MT5 on Wine, you will find old advice that says any recent Wine will do. In my experience, that advice is wrong for the current MT5 build. I tested six Wine setups, and all six failed in exactly the same way.

Each time, the terminal and MetaEditor showed the same dialog: "A debugger has been found running in your system. Please, unload it from memory and restart your program." The log carried the same line every time: fixme:ntdll:NtRaiseHardError 0x50000018. The dialog is MT5's own anti-debugger warning, in its own words, and my reading of the evidence is that its protection is firing under Wine. The dialog and the log line are what I observed. I cannot see inside MT5 to prove the exact internal trigger, but the pattern was consistent. The programs never got past that dialog. Here is the full list:

Attempt 1: Wine 9.22, vanilla. Result: Debugger dialog, same error code.
Attempt 2: Wine 10.0, vanilla. Result: Debugger dialog, same error code.
Attempt 3: Wine 10.2, vanilla. Result: Debugger dialog, same error code.
Attempt 4: Wine 10.0, vanilla, Windows 11 prefix. Result: Debugger dialog, same error code.
Attempt 5: Wine 10.0, Staging. Result: Debugger dialog, same error code.
Attempt 6: Wine 10.0, vanilla, fresh Windows 11 prefix. Result: Debugger dialog, same error code.

Notice what did not help. Changing the Wine version from 9.22 to 10.0 to 10.2 did not help. Switching the prefix from Windows 10 to Windows 11 did not help, whether I converted an existing prefix or built a fresh one. Staging patches did not help. The failure was the same in all six cases: the same dialog and the same error code every time.

I also checked an older MT5 build as a way out. Build 6257 is a real build, and other traders were running it in October 2026. But MetaQuotes publishes no old installers, and its own forum says it does not sanction downgrading to previous builds. The only copies available were user provided files from community archives, with no official hashes to check them against. I did not download or use any of them. A build you cannot verify is not a foundation to build on.

The lesson from the six failures is simple. The problem was not my prefix, my Windows version setting, or my install. The problem was the Wine version itself. In my setup, MT5 build 6295 failed with the Wine versions I tested up to 10.2, but worked when I moved to Wine 11.6.

The breakthrough: Wine 11.6

The seventh attempt worked. I used Kron4ek Wine 11.6, vanilla, amd64-wow64 build, release 11.6, published 2026-04-06. The tarball is 86,409,508 bytes, and its official SHA256 hash is 045549657b513c2fb191734b0434c81000b36ba4d482d1688bf99f80a8ee07a5. I checked the hash before extracting, and it matched. That check matters. A Wine build is a large download from the internet, and you should always verify it before you run anything from it.

I extracted the build into its own folder in my home directory, so it never touched the system Wine or any other program. Then I created a fresh prefix for it and ran the official MetaQuotes installer, mt5setup.exe, in that prefix. This time there was no debugger dialog. The terminal launched to its full main window, with Market Watch quotes, charts, Navigator, and Journal all visible. MetaEditor launched to its full editor window, with the MQL5 Navigator tree and the Compile button.

The terminal's own log confirmed what I was seeing:

"Windows 10 build 19043 on Wine 11.6 Linux 7.0.0-39-generic, 4 x AMD EPYC 9D64, AVX2"

The MCP channel started on 127.0.0.1:22346 in that run. That channel matters later, because the command line compile is serviced through it.

Two practical notes from the install. First, the first run of a fresh prefix can stall behind a prefix update. In my run, a stuck update process blocked the terminal loader and left a blank screen. I cleared the stuck update processes by their process IDs and relaunched the terminal directly, and it came up. If your loader stalls on the first run, check for a stuck prefix update before you assume Wine 11.6 failed. Second, never kill Wine windows with a command that kills the whole Wine client. I learned that the hard way in an earlier attempt, when a kill command aimed at a small popup window took the entire installer with it. Kill by process ID, and only the process you mean to kill.

Installing MT5, step by step

Here are the exact commands I used. Every command uses the full path to the portable Wine 11.6 binary and an explicit WINEPREFIX, so nothing depends on your system Wine or your default prefix. Adjust the folder names to your own setup. Note that in Wine 11.6 there is no wine64 binary. The bin/wine binary is the 64-bit loader.

# 0. Only if you have no physical screen: start a virtual display Xvfb :99 -screen 0 1280x800x24 -dpi 96 & export DISPLAY=:99 # 1. Download the Wine 11.6 vanilla amd64-wow64 build # Releases page: https://github.com/Kron4ek/Wine-Builds/releases/tag/11.6 # File: wine-11.6-amd64-wow64.tar.xz (86,409,508 bytes) # Direct link: https://github.com/Kron4ek/Wine-Builds/releases/download/11.6/wine-11.6-amd64-wow64.tar.xz # 2. Check the hash before you extract it sha256sum wine-11.6-amd64-wow64.tar.xz # It must read: 045549657b513c2fb191734b0434c81000b36ba4d482d1688bf99f80a8ee07a5 # 3. Extract it into its own folder mkdir -p ~/portable-wine/wine-11.6 tar -xf wine-11.6-amd64-wow64.tar.xz -C ~/portable-wine/wine-11.6 --strip-components=1 # 4. Create a fresh prefix for MT5. Do not reuse a prefix from the failed Wine versions. # MT5 needs no .NET, so cancel the Wine Mono Installer dialog if it appears. WINEPREFIX=~/MT5-prefix ~/portable-wine/wine-11.6/bin/wine wineboot --init # 5. Run the official MetaQuotes web installer in that prefix and let it download. # Download mt5setup.exe from the MetaQuotes website first and save it in your Downloads folder. WINEPREFIX=~/MT5-prefix ~/portable-wine/wine-11.6/bin/wine ~/Downloads/mt5setup.exe # 6. Launch the terminal inside the Wine virtual desktop cd ~/MT5-prefix/drive_c/"Program Files"/"MetaTrader 5" WINEPREFIX=~/MT5-prefix ~/portable-wine/wine-11.6/bin/wine explorer /desktop=MT5Desk,1280x800 terminal64.exe

In my run the WebInstall folder grew from 0 to 51 MB and then to 109 MB, and then Program Files/MetaTrader 5 appeared at 340 MB, containing terminal64.exe, MetaEditor64.exe, and metatester64.exe. The installer then exited on its own. Launch the terminal from the install folder and confirm it opens to its main window with no debugger dialog.

If the installer stops at a proxy dialog and the OK button does nothing, your problem is almost certainly the network, not the dialog. That happened to me in an earlier attempt. The installer could not reach MetaQuotes, and the dialog was waiting on a connection that never came. Which brings me to the network step.

The network gate

In my environment, Wine's outbound network traffic was blocked at first. The container I work in has a permission setting called "Direct network protocols", and the "other TCP" row was set to Deny. Wine's connection attempts never reached the internet at all. The fix was to change that setting from Deny to Ask, and then approve the connection requests as they appeared. The installer then downloaded normally.

Your setup may differ. If you run Linux on your own computer, you probably have no such gate, and the installer will download without this step. But if you work in a container or a managed environment and the installer cannot connect, check your network permissions before you blame Wine or the installer. A blocked connection looks exactly like a broken installer: dialogs that do nothing, downloads that never start, and no error message that tells you why.

The virtual desktop keyboard fix

Once the terminal was running, I hit the next problem. Keyboard input did not work. Menus would not open with Alt shortcuts, Ctrl+M and Ctrl+T did nothing, and typing into dialogs did nothing. The terminal looked alive but would not take keyboard input. Mouse clicks were also unreliable in the plain Xvfb window.

The fix was the Wine virtual desktop. I launched the terminal inside a virtual desktop window like this:

~/portable-wine/wine-11.6/bin/wine explorer /desktop=MT5Desk,1280x800 terminal64.exe

Run it from the install folder, with WINEPREFIX set to your MT5 prefix, as in the install steps above. That one change restored keyboard input. Escape closes dialogs, Alt+F opens menus, arrow keys and Tab move through fields, and typing works. The virtual desktop gives Wine a proper window to manage, and the terminal behaves.

Mouse clicks, however, remain dead inside the virtual desktop. Dialog buttons, combo arrows, tabs, and Next buttons do not respond to clicks. Only keyboard navigation works. That sounds like a severe limit, and it is a limit, but it is a workable one. Every action I needed has a keyboard path:

  • Tab moves between fields in a dialog. In the login dialog, Tab moves from the login field to the password field.
  • Arrow keys move through lists and combo boxes. Server lists in MT5 dialogs are selection only, so you pick from the list with the arrow keys. Typing a server name that is not in the list will revert.
  • Alt plus a letter opens menus. Alt+F opens the File menu.
  • Escape closes a dialog.
  • Enter confirms, and Space activates a focused button.

One more warning about focus. Focus can drift to stray windows, and then your keystrokes go nowhere. Before you send keys, always focus the terminal window first. If a dialog seems to ignore you, check which window actually has focus before you conclude the dialog is broken.

The dialog that hides

There is one more trap, and it cost me hours the first time because it is invisible. When you attach an Expert Advisor to a chart or run a script, MT5 shows a properties dialog first. Nothing starts until you confirm that dialog with OK. The problem is that this dialog can hide behind the terminal window. The program then looks loaded, with no output, for minutes, while it is actually waiting on a dialog you cannot see.

The fix is to focus the chart window, not the main terminal window. Focusing the chart brings the dialog to the front. Press OK, and the output appears within seconds. If your program produces no output at all, check for this hidden dialog before you debug your code. In my experience, a silent program on this setup is almost always the hidden dialog, not a code error.

The dialog also carries an "Allow Algo Trading" checkbox. That checkbox gates trading operations only. It is not a precondition for a program to start, and it is not what stands between you and the output of a program that does not trade. Both teaching programs in this article are written to print information and write a file. Neither program places a trade, so the checkbox is not required for its intended output. I have not executed these two teaching programs in this VM, as explained in the teaching-code section.

Terminal-wide Algo Trading, toggled with Ctrl+E, is the same story. It is needed before any program that places trades. These two teaching programs do not trade, so it is not a precondition for their intended output either. Keep Ctrl+E in mind for the day you run a program that does trade, and do not chase it when a non-trading program stays silent.

The compile problem: AVX2 versus X64 Regular

With the terminal running, I compiled a small test Expert Advisor in MetaEditor with F7, the normal GUI compile. It worked. The result was Wine116Test.ex5, 6,820 bytes, with 0 errors, 0 warnings, in 762 ms. The compile log said cpu='AVX2 + FMA3'. I thought I was done.

I was not done. When I uploaded an AVX2 compiled file to the MQL5 Market, the site rejected it with this exact error:

"File is compiled for CPU_ARCH_AVX2 CPU architecture. The Market supports "X64 Regular" only. Please recompile the file."

The MQL5 Market accepts X64 Regular files only. MetaEditor has two separate compiler settings, and I mixed them up at first: the optimization mode, and the target CPU architecture. The target architecture can be X64 Regular, AVX, AVX2, AVX512, and other options. The Market requires X64 Regular. Disabling optimization does not by itself select X64 Regular. Those are two different choices, and the first version of this article got that wrong.

What I can report is what I observed in my own runs. In this Wine setup, the GUI compile produced AVX2 output: cpu='AVX2 + FMA3'. The command line compile on 25 November and the terminal's startup auto-compile both produced X64 Regular output: cpu='X64 Regular'. I do not know the exact internal reason for the difference, and I will not claim one. What I know is what the log said, and the log is the check that matters. After every compile, read the log line. If it says cpu='AVX2 + FMA3' or any other AVX2 wording, that file is not for the Market. If it says cpu='X64 Regular', that file is the one to upload. The words "without optimizations" appeared in my X64 Regular log lines, but the cpu value is the check, not the wording.

This was a real blocker. I tried several routes before I found the working one. Masking the CPU features did not work, because the masking layer ends at the process boundary and the compiler sees the real CPU anyway. Patching the compiled file did not work, because the EX5 container is encrypted. An older MetaEditor was not available from any legitimate source, and I did not chase community copies. A native Windows compile was not available to me, because I had no Windows computer at all.

The working method: startup auto-compile first

The reliable route in my runs is the terminal's startup auto-compile. Place an MQ5 file in the MQL5/Experts, MQL5/Scripts or MQL5/Indicators folder and start the terminal. The terminal compiles it on startup, and the log reports the result. This worked for the v1.04 and v1.05 builds of my two Pro indicators, it worked for the teaching files in this article on 28 November, and it worked again the same day after I revised them. It is the route I recommend, because it is the one that has worked every time I tried it.

You can read the result in two places: the terminal's logs/metaeditor.log file, and the MetaEditor Errors tab. After every compile, read the log line and confirm 0 errors, 0 warnings, and cpu='X64 Regular'.

The command line compile: a documented alternative that did not reproduce

The other route is the MetaEditor command line compile. The documented command uses the /include switch for the MQL5 folder and /log for the compilation log. Show the working directory and the prefix explicitly, because the prefix is set only for the command being run. If you copy this into another terminal without it, MetaEditor could launch with the default Wine prefix instead of the prefix that holds MT5:

cd "$HOME/MT5-prefix/drive_c/Program Files/MetaTrader 5" WINEPREFIX="$HOME/MT5-prefix" \ "$HOME/portable-wine/wine-11.6/bin/wine" \ "$HOME/MT5-prefix/drive_c/Program Files/MetaTrader 5/MetaEditor64.exe" \ /portable \ /compile:"C:\Program Files\MetaTrader 5\MQL5\Experts\HelloLinux.mq5" \ /include:"C:\Program Files\MetaTrader 5\MQL5" \ /log

Replace the paths with your own file and your own MQL5 folder. The /include switch is only needed for code that uses .mqh include files. The teaching programs in this article use no includes, so they do not need it. Run the command while the terminal is running.

Be clear about what this command is. I have not run this corrected form myself. The attempts on 28 November used the shorter form, without the explicit prefix, working directory, and full paths, and they failed silently. So treat this as the documented method I attempted, not as a proven working alternative. The startup auto-compile above is the route I recommend, because it is the one that has worked every time. I tried the command line compile seven times without the terminal running, and all seven times it failed silently: exit code 0, no output, no EX5 file, no log. The compile is serviced through the terminal's MCP channel, so with no terminal running there is nothing to service it. Start the terminal first, then run the compile command.

The command line compile worked for me on 25 November. That is how the Trade Planner file below was built. But it did not reproduce on 28 November. Across that day, the command line compile failed silently four times while the terminal was running: three times with the older /inc form and once with the documented /include form. Each time the result was the same: exit code 0, no output, no log change, no new EX5 file. One more attempt failed only because I ran it from the wrong directory. That one was my error, not the compiler's. I do not know why the silent failures happened, and I will not guess. The startup auto-compile worked on both days, and it is the route I recommend. If you use the command line route, verify the result in the log before you trust it, and fall back to the startup auto-compile if it stays silent.

The proof: product 211310

I proved this end to end with a real product. I compiled the Steadymove Trade Planner source with the command line method while the terminal was running. The result was "Steadymove Trade Planner-x64cli.ex5", 76,200 bytes, MD5 ce5e5ac7c1ed67053178e400e9a758f3, with 0 errors and 0 warnings in 1112 ms, and cpu='X64 Regular'. I uploaded that file to the MQL5 Market as version 1.10 of the product. The Market accepted it. Automatic validation passed, and the product was published on 25 November 2026 as product 211310.

The same method produced the X64 Regular builds for the other two products published the same day: Steadymove HalfTrend Pro, product 211376, and Steadymove SuperTrend Pro, product 211382. All three were built in this Linux setup, compiled to X64 Regular, and published. That is the end to end proof. The method is not a theory. It has already passed Market validation three times.

A note on file size, because it confuses people. The GUI compiled AVX2 build of the Trade Planner was smaller than the X64 Regular build: 55,352 bytes against 76,200 bytes. That is normal for these two builds. Do not judge a build by its size. Judge it by the cpu value in the compile log. If the log says AVX2, the Market will reject it. If the log says cpu='X64 Regular', the file is the one to upload.

How to tell which build you have

You do not need a special tool to check. The compile log tells you. After every compile, read the log line. If it says cpu='AVX2 + FMA3' or any other AVX2 wording, that file is not for the Market. If it says cpu='X64 Regular', that file is the one to upload. Keep a record of the file size and the MD5 hash of the file you upload, and check the hash again before you upload, so you know the file on the Market is exactly the file you compiled. I record the hash for every published version, and I check it before every upload.

The teaching code

Below are two small programs I wrote for this article. They are teaching code, written fresh for this article. They are not copies of any product source. Both are complete, both compile, and both use only standard MQL5 functions. Neither opens trades, uses a DLL, nor sends information to an external service. They only read terminal information and, in the case of CompileCheck, write it to a local CSV file. Their only job is to prove that your setup works.

One honest note before you run them. I have compiled both programs successfully, but I have not yet executed them in this virtual machine. Neither has been attached to a chart or run here, so the log lines and the CSV file described below are the behaviour intended by the source code, not output I have observed. Please run them on your own terminal and check the log messages and the CSV file for yourself. A successful compile proves the compiler accepted the source. It does not prove the log output or the CSV output has been observed.

The first is HelloLinux.mq5, a minimal Expert Advisor. Attach it to any chart and it is written to print terminal information to the Experts log: the terminal build, the terminal name, the company, the paths, whether the terminal is connected, the terminal-wide AutoTrading permission, and the program-level trading permission. If you see those lines in your log, your terminal, your MetaEditor, and your compile chain all work.

//+------------------------------------------------------------------+ //| HelloLinux.mq5 | //| Copyright 2026, Sahir Silvia | //| https://www.mql5.com/en/users/steadymove1 | //+------------------------------------------------------------------+ #property copyright "Copyright 2026, Sahir Silvia" #property link "https://www.mql5.com/en/users/steadymove1" #property version "1.01" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { Print("HelloLinux: terminal started on Linux under Wine."); Print("Terminal build: ", TerminalInfoInteger(TERMINAL_BUILD)); Print("Terminal name: ", TerminalInfoString(TERMINAL_NAME)); Print("Company: ", TerminalInfoString(TERMINAL_COMPANY)); Print("Path: ", TerminalInfoString(TERMINAL_PATH)); Print("Data path: ", TerminalInfoString(TERMINAL_DATA_PATH)); Print("Connected: ", TerminalInfoInteger(TERMINAL_CONNECTED) ? "yes" : "no"); Print("Terminal AutoTrading allowed: ", TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) ? "yes" : "no"); Print("Program trading allowed: ", MQLInfoInteger(MQL_TRADE_ALLOWED) ? "yes" : "no"); Print("DLLs allowed: ", TerminalInfoInteger(TERMINAL_DLLS_ALLOWED) ? "yes" : "no"); Print("Max bars in chart: ", TerminalInfoInteger(TERMINAL_MAXBARS)); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { Print("HelloLinux: stopped. Reason code: ", reason); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { } //+------------------------------------------------------------------+

The second is CompileCheck.mq5, a minimal script. Run it once and it is written to write a file called CompileCheck.csv into the MQL5/Files folder. The file holds the same terminal information in a table: build, name, company, paths, connection state, CPU cores, and memory. Open the CSV in any spreadsheet and you have a written record of your setup. Keep a copy of this file for every machine you set up, so you can compare setups later. Every write is checked, and the script only reports success if every row was written. If a write fails, it prints the error and tells you the file is incomplete.

//+------------------------------------------------------------------+
//|                                                  CompileCheck.mq5 |
//|                                          Copyright 2026, Sahir Silvia |
//|                              https://www.mql5.com/en/users/steadymove1 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Sahir Silvia"
#property link      "https://www.mql5.com/en/users/steadymove1"
#property version   "1.02"
#property strict
#property script_show_inputs

input string InpFileName = "CompileCheck.csv";

//+------------------------------------------------------------------+
//| Write one row and report failure                                 |
//+------------------------------------------------------------------+
bool WriteRow(const int handle, const string item, const string value)
{
   ResetLastError();
   if(FileWrite(handle, item, value) < 1)
   {
      Print("CompileCheck: failed to write row '", item, "'. Error: ", GetLastError());
      return(false);
   }
   return(true);
}

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
   ResetLastError();
   int handle = FileOpen(InpFileName, FILE_WRITE | FILE_CSV, ';');
   if(handle == INVALID_HANDLE)
   {
      Print("CompileCheck: cannot open file ", InpFileName, ". Error: ", GetLastError());
      return;
   }
   bool ok = true;
   ok = WriteRow(handle, "Item", "Value") && ok;
   ok = WriteRow(handle, "Terminal build", IntegerToString(TerminalInfoInteger(TERMINAL_BUILD))) && ok;
   ok = WriteRow(handle, "Terminal name", TerminalInfoString(TERMINAL_NAME)) && ok;
   ok = WriteRow(handle, "Company", TerminalInfoString(TERMINAL_COMPANY)) && ok;
   ok = WriteRow(handle, "Terminal path", TerminalInfoString(TERMINAL_PATH)) && ok;
   ok = WriteRow(handle, "Data path", TerminalInfoString(TERMINAL_DATA_PATH)) && ok;
   ok = WriteRow(handle, "Connected", TerminalInfoInteger(TERMINAL_CONNECTED) ? "yes" : "no") && ok;
   ok = WriteRow(handle, "Trade allowed", TerminalInfoInteger(TERMINAL_TRADE_ALLOWED) ? "yes" : "no") && ok;
   ok = WriteRow(handle, "DLLs allowed", TerminalInfoInteger(TERMINAL_DLLS_ALLOWED) ? "yes" : "no") && ok;
   ok = WriteRow(handle, "CPU cores", IntegerToString(TerminalInfoInteger(TERMINAL_CPU_CORES))) && ok;
   ok = WriteRow(handle, "Memory total MB", IntegerToString(TerminalInfoInteger(TERMINAL_MEMORY_TOTAL))) && ok;
   ok = WriteRow(handle, "Memory used MB", IntegerToString(TerminalInfoInteger(TERMINAL_MEMORY_USED))) && ok;
   FileClose(handle);
   if(ok)
      Print("CompileCheck: wrote ", InpFileName, " to MQL5/Files.");
   else
      Print("CompileCheck: file ", InpFileName, " is incomplete, see errors above.");
}
//+------------------------------------------------------------------+

Project files

File: HelloLinux.mq5 (v1.01). Type: Expert Advisor. Purpose: Prints terminal info to the Experts log, proves the terminal and compile chain work.
File: CompileCheck.mq5 (v1.02). Type: Script. Purpose: Writes terminal and build info to CompileCheck.csv in MQL5/Files.

To use them, copy HelloLinux.mq5 into MQL5/Experts and CompileCheck.mq5 into MQL5/Scripts in your MT5 data folder. Then start the terminal and let the startup auto-compile do its work. Read the compile log (logs/metaeditor.log, or the MetaEditor Errors tab) after each compile. Both files compiled in my setup on 28 November 2026 with 0 errors and 0 warnings, and both logs reported cpu='X64 Regular': HelloLinux v1.01 in 646 ms (HelloLinux-x64.ex5, 8,250 bytes) and CompileCheck v1.02 in 649 ms (CompileCheck-x64.ex5, 8,968 bytes).

Then attach HelloLinux to any chart. Remember the hidden dialog: when the properties dialog appears, press OK to confirm it, or nothing will happen. The "Allow Algo Trading" checkbox in that dialog gates trading only, and HelloLinux does not trade, so the checkbox does not affect its intended output. If you see the terminal info lines in the Experts log, your setup is proven. Then run CompileCheck once and open CompileCheck.csv in MQL5/Files. If the CSV has one row per item, your file writing works too.

Reader checklist

Here is the whole setup as a checklist. Work through it in order, and do not skip a step.

  1. Download Wine 11.6 and verify the SHA256 hash before you extract it.
  2. Extract Wine 11.6 to its own folder in your home directory.
  3. Create a fresh Wine prefix for MT5. Do not reuse a prefix from an older Wine version.
  4. Start a virtual display if you have no physical screen.
  5. Run the official MetaQuotes web installer in the prefix and let it download. Confirm that Program Files/MetaTrader 5 appears with terminal64.exe, MetaEditor64.exe, and metatester64.exe.
  6. If the installer cannot connect, check your network permissions before you blame Wine.
  7. Launch the terminal inside the virtual desktop and confirm it opens to its main window with no debugger dialog.
  8. Confirm the terminal log shows the Wine 11.6 line and the MCP channel starting.
  9. Copy HelloLinux.mq5 to MQL5/Experts and CompileCheck.mq5 to MQL5/Scripts.
  10. Start the terminal and let the startup auto-compile run. Read the compile log and confirm 0 errors, 0 warnings, and cpu='X64 Regular' for both files.
  11. Attach HelloLinux to a chart. Confirm the properties dialog with OK. Read the Experts log and confirm the terminal info lines.
  12. Run CompileCheck once and open CompileCheck.csv in MQL5/Files. Confirm every row is present.
  13. Record the file size and MD5 hash of every EX5 file you intend to upload, and check the hash again before you upload.

Limitations

I want to be plain about what does not work in this setup, because a setup with hidden limits is worse than no setup at all.

First, the Strategy Tester does not run locally in my VM. The tester program, metatester64.exe, runs only as the Agents Manager. It reports 0 agents and no listening port, so no local agent ever spawns and no test ever starts. I have not fixed this. If your work depends on local backtests in the Strategy Tester, this setup will not give them to you today. Market validation, which runs on MQL5 servers, still works, and that is how my three products were validated. But a local Tester run is not something I can show you, and I will not claim otherwise.

Second, the debugger link breaks. When I tried to run scripts through the MetaEditor debugger, the link failed with IO error 3e3/995, and the script never executed. GUI driven script runs work, and the startup auto-compile works, but live debugging through MetaEditor does not work in this setup.

Third, the Deriv demo login failed three times in my setup. Each time the journal said "connection to Deriv-Demo lost", even though the host machine could reach the Deriv servers normally. I stopped retrying, and the login is paused. That means I have not run a connected live feed test in this setup, and I have not verified tick by tick behaviour on a live account here. The terminal runs, the charts load with history, and the compile chain works, but a live connected session is still unverified in my VM.

Fourth, mouse clicks remain dead in the virtual desktop. Everything works through the keyboard, but if you depend on mouse driven dialogs, you will find this setup slow. The keyboard paths I listed above cover every action I needed, but I will not pretend the experience is the same as Windows.

Fifth, the command line compile did not reproduce on 28 November. It worked on 25 November and produced the X64 Regular file that passed Market validation, but on 28 November it failed silently four times while the terminal was running: three times with the older /inc form and once with the documented /include form. The startup auto-compile worked on both days, and it is the route I recommend. I do not know why the command line compile failed silently on that day, and I will not guess.

Sixth, this is one tested configuration. I tested MT5 build 6295 on Wine 11.6 in a Linux container with 7.7 GiB of RAM and 4 virtual CPUs. A future MT5 build may change the anti-debugger behaviour, and a future Wine release may change it again. If you follow this article a year from now, check the Wine version and the MT5 build first, and expect to retest.

None of these limits changes the core result. The terminal runs, MetaEditor compiles, the startup auto-compile produces X64 Regular files, and a command line X64 Regular build passed Market validation on 25 November. But the limits are real, and you deserve to know them before you invest your time.

What this unlocks

Before this setup existed, a Linux trader who wanted to develop for MT5 had three choices: buy Windows, pay for a Windows VPS, or give up. All three cost money or access that many traders do not have. This setup removes that barrier. With free tools only, you can run the terminal, write code in MetaEditor, compile it to the exact format the Market accepts, and publish.

That matters beyond convenience. It means a trader on an old laptop, or on Linux as a first choice, can build and publish on the same terms as anyone else. The three products I published through this setup are free, and they were built entirely on Linux. Nobody who downloads them can tell from the product page what operating system built them, and that is the point. The work is judged by the file, not by the machine behind it.

There is more work to do. The Strategy Tester agent problem is the biggest open item, and a live connected session test is the second. I will keep working on both, and I will write up what I find, including the failures. If you try this setup and you solve one of those two problems, or you find a step I missed, say so in the comments. A working Linux workflow for MT5 is worth building in the open, and it gets better every time someone reports what actually happened on their machine.

If you follow the checklist and your terminal opens, your compile log says cpu='X64 Regular', and HelloLinux prints its lines to your log, you have done it. You are running MetaTrader 5 on Linux, and you are compiling for the Market. That is the whole point of this article, and it is a good place to start building.