What is MT5 Optimizations?
MT5 Optimizations lets Ultimate subscribers run batch forward optimization of their own Expert Advisors from the PositionRelay dashboard. A Docker worker on your computer polls the cloud every few seconds and executes Start, Stop, Resume, and Clean commands.
You provide the EA (.ex5), parameter grids (.set), and an MT5 broker account (demo or live). Results land in a host reports folder and sync back to the dashboard as passes and favorites. Company portfolios need the source code of the supported portfolio EA.
This feature is self-hosted. PositionRelay does not run MetaTrader for you. There is no hosted optimizer today.
How it works
The published Wine + MetaTrader 5 Docker image runs on your machine. The heartbeat process authenticates with your PositionRelay User ID, checks Ultimate access, and waits for dashboard commands.
When you start a run, the worker launches Strategy Tester jobs for the symbols, timeframes, and strategies you selected. Validated survivors appear under Passed and Favorites. A company portfolio can be built from favorites only when the source code of the supported portfolio EA is available.
- Subscribe to Ultimate and open Dashboard → Setup → MT5 Optimizations.
- Install Docker and follow the setup wizard for your operating system.
- The wizard shows the exact folders, files, and commands to copy.
- Check the first-start logs for broker authorization, then confirm the worker shows online on Dashboard → Optimizations.
- Configure dates, symbols, and strategies, then Start a run.
Requirements
- Active PositionRelay Ultimate subscription.
- An x64 computer running Windows, Linux, or Intel macOS with Docker. Apple Silicon / ARM is unsupported.
- Enough RAM and disk for real-ticks history (configure Docker Desktop resources if you use it).
- An MT5 broker account, demo or live (login, password, server).
- Your own compiled EA (.ex5). MQL5 Market EAs are activation-locked and will not run.
- Parameter grids as .set files in the SetFiles/Classic/<timeframe> layout the wizard describes.
Installation
The step-by-step installation lives in one place: the setup wizard in your dashboard. It matches commands, folders, and file paths to your operating system and fills in your User ID.
Where your files live: option 1 is a folder on your own computer (C:\PositionRelay\optimizer on Windows, $HOME/PositionRelay/optimizer on Linux and macOS) holding your EA, set files, Broker/servers.dat and optimizer.env. It is the only option today, and the wizard uses it. Option 2, uploading your EA, set files and env variables to PositionRelay, is coming soon and will be at your own risk.
Open Dashboard → Setup → MT5 Optimizations and follow the steps in order.
Each -v mount for Experts, SetFiles, Broker, and reports has your computer's folder path on the left and a /data/... container path on the right. If your files are elsewhere, replace each full host path, including the drive letter on Windows. Changing --env-file alone does not change those mounts.
In a working MT5 terminal, choose File → Open Data Folder. Copy config/servers.dat into your optimizer Broker folder so the Docker terminal can find your broker. Copy only that file; accounts.dat contains account data. The setup wizard shows the exact destination.
On the first start, broker login runs before the heartbeat and can take several minutes. Follow the container logs in the setup wizard. After the log says "Starting optimizer heartbeat", allow a few polls for the worker to show online on the Optimizations page.
- Never commit optimizer.env.
- Experts and SetFiles are mounted read-only; reports are writable.
- The MT5 tree and tick cache live on the named volume positionrelay-mt5.
Run from the dashboard
Open Dashboard → Optimizations. Choose the date range, symbols, timeframes, strategies, optimization mode, balance, and max equity drawdown. Optionally enable robustness after validation.
Start begins a new batch. Resume continues an interrupted run. Stop halts the active batch; the worker stays online. Clean clears tester cache artifacts on the host.
Live status refreshes every few seconds while the page is open. Keep the container running for the duration of the job.
Results, favorites, and portfolio
Passed rows are validated survivors from the batch. Mark favorites in the dashboard; the worker can sync them into the Favorites folder on the host.
Company portfolios currently support only one PositionRelay portfolio EA and need its source code, which the public image does not include. With your own compiled .ex5 you can optimize, validate, and favorite, but not build portfolios.
Reports are also written to the reports folder you created on the host.
Updating the image
To check for a newer image, run docker pull ghcr.io/razvantomegea/position-relay-portfolio-optimizer:latest (the Download command in the setup wizard). Pull status only describes the local image—not whether the running container already uses it. Compare docker inspect --format '{{.Image}}' positionrelay-optimizer with docker inspect --format '{{.Id}}' ghcr.io/razvantomegea/position-relay-portfolio-optimizer:latest. If they match, leave the container running. If they differ—or you already downloaded one earlier and deferred recreation—wait for any active run to finish, then recreate the container with the commands in the last step of the setup wizard. An image update replaces the worker software only; host folders and the positionrelay-mt5 volume keep your EA, grids, reports, MetaTrader 5 install, and tick cache.
A newer MetaTrader 5 build is not applied automatically. The wizard explains how to refresh it once while keeping your data. Changes to optimizer.env also need a new container; an existing container keeps its original environment.
Troubleshooting
- Worker stays offline — confirm Ultimate is active, POSITIONRELAY_USER_ID matches Setup, and docker logs show the heartbeat polling.
- Broker login not confirmed — check Broker/servers.dat from your working MT5 terminal, then MT5_LOGIN, MT5_PASSWORD, and MT5_SERVER. Clear the password only after the log shows "Broker login authorized".
- Wine may print fixme messages and graphics-library errors during first login. Those lines alone do not confirm success or failure. Look for "Broker login authorized" or "broker login not confirmed", then "Starting optimizer heartbeat". A worker can be online even when broker login failed.
- EA will not run — Market-purchased EAs are activation-locked. Use your own compiled .ex5.
- Out of disk / slow ticks — raise Docker Desktop Resources and free space for real-ticks history.
- Apple Silicon / ARM — unsupported. Use an x64 computer.
- Command failed on the dashboard — open docker logs -f positionrelay-optimizer for the worker error.
