Sign inSign up

psyb0t/mql-compiler

By psyb0t

•Updated 16 days ago

Compile MQL4 and MQL5 on Linux: MetaEditor under Wine in Docker, one command, compile errors in y...

Image
0

1.2K

psyb0t/mql-compiler repository overview

Source⁠

⁠docker-mql-compiler

CI version license Docker Pulls

Compile MQL4 and MQL5 on Linux without booting a goddamn Windows box. One command, and MetaQuotes' own MetaEditor wakes up inside a Wine container, chews through your .mq4 and .mq5 files, shits out .ex4 and .ex5 right next to them, and hands back every error as JSON your agent can actually use. Humans get --text.

No Windows. No MetaTrader window to babysit. No broker account. No clicking "Compile" in a GUI that looks like it escaped from 2009.

⁠Quick start

Docker must be running on an x86-64 (amd64) machine. There is no ARM image.

curl -fsSL https://raw.githubusercontent.com/psyb0t/docker-mql-compiler/master/install.sh | bash

# Compile the sources under your current folder.
mql-compiler --text .

The command lands in ~/.local/bin. Add that folder to your PATH if the installer tells you to. The first compile downloads only the MT4 or MT5 toolchain your sources need, verifies its signature and caches it. Allow about a minute and a half for setup; later runs take seconds.

A successful compile puts Foo.ex4 or Foo.ex5 beside Foo.mq4 or Foo.mq5, owned by you. Fix any reported errors and run the command again. Exit 0 means every source compiled, 1 means at least one failed, and 2 means bad arguments or failed setup.

Warning

This compiles your EA. It does not make your EA any good. If the thing compiles clean and then martingales your account into the ground, that one's on you.

⁠Using the damn thing

mql-compiler MQL5/Experts/Scalper.mq5   # one source, JSON Lines by default
mql-compiler --text MQL5 MQL4           # folders, both platforms
mql-compiler --watch MQL5/Experts       # recompile on save until Ctrl-C
mql-compiler --werror MQL5              # warnings fail the run
mql-compiler -I ~/libs/mql5 MQL5        # shared headers outside your tree
mql-compiler --mt5-terminal ~/mt5 MQL5  # use a portable terminal already on disk
mql-compiler --version                 # image version and MetaEditor builds
mql-compiler --update                  # reinstall the cached toolchain

Keep sources under MQL4 or MQL5, with your headers in that folder's Include. Standard headers work too. Your own headers win when they replace a standard one. Files, folders, mixed platforms and paths with spaces all work.

Without --text, stdout is JSON Lines: a file record for each source and a final summary. Progress goes to stderr. Scripts and agents should parse the JSON, not scrape the pretty output.

{"type":"file","source":"MQL5/Experts/Hello.mq5","platform":"mt5","status":"ok","output":"MQL5/Experts/Hello.ex5","errors":0,"warnings":0,"messages":[]}
{"type":"summary","total":1,"compiled":1,"failed":0,"werror":false}

⁠Where the fuck are the details?

You needRead this
Install, upgrade, uninstall, choose installers or change the cacheInstallation and configuration⁠
Every option, result field, exit code, include rule and portable-terminal requirementUsing mql-compiler⁠
Wine, signature checks, cache layout, mounts and how MetaEditor runsArchitecture⁠
GitHub Action inputs, outputs and running Docker by handCI and Docker⁠
Build, test, lint and contributor commandsDevelopment⁠

The docs links are absolute so they work on Docker Hub too.

⁠GitHub Action

- uses: actions/checkout@v6
- uses: psyb0t/[email protected]
  with:
    paths: MQL5/Experts

Compilation errors fail the job and become annotations on the source lines. The CI guide⁠ covers includes, warnings, caching and result outputs.

⁠Agent integrations

The mql-compiler skill⁠ teaches Claude Code, Codex, OpenClaw and peen⁠ to install the command, compile and read the JSON results without making shit up. Every release publishes it to ClawHub⁠.

⁠License

WTFPL⁠. Do what the fuck you want.

MetaTrader, MetaEditor and their installers are MetaQuotes software and none of it lives in this repo or the image. The first run downloads it from the broker, and MetaQuotes' license covers it. See THIRD_PARTY.md⁠.

Tag summary

Content type

Image

Digest

sha256:0fc0086e7…

Size

665 MB

Last updated

16 days ago

docker pull psyb0t/mql-compiler