> For the complete documentation index, see [llms.txt](https://docs.metacopier.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metacopier.io/features/custom-ea-hosting.md).

# EA hosting

With **EA hosting** you can run your own expert advisors (EAs) on MetaTrader 4 and MetaTrader 5 accounts connected to MetaCopier. You upload the compiled expert once, pick the account, symbol and timeframe, and MetaCopier keeps the expert running 24/7. There is no VPS to rent and no terminal to maintain.

Every hosted expert runs in its **own MetaTrader terminal**, separate from the one MetaCopier uses for copying. If an expert crashes or hangs, your copiers keep working.

EA hosting only runs experts on your connected accounts. MetaCopier does **not** offer backtesting or forward testing of experts.

{% hint style="warning" %}
EA hosting is currently in **beta**. Behaviour and limits may still change, and occasional issues are possible. Please report any problems to support.
{% endhint %}

## Requirements

* The account is a **MetaTrader 4** or **MetaTrader 5** account. Other platforms are not supported.
* The account is **active**.
* You have the **compiled** expert file: `.ex5` for MT5 or `.ex4` for MT4. Source files (`.mq5` / `.mq4`) cannot be run.

## Pricing

* **USD 0.23 per hosted expert per day** (USD 6.90 per 30 days), calculated daily. See [Billing](/metacopier/billing.md#ea-hosting).
* The charge applies for as long as the deployment exists, **on top of the account price**.
* It is its own invoice position and does **not** add the Pro feature surcharge.
* The price multiplies with the number of experts. For example, 3 hosted experts on one account cost USD 0.69 per day (USD 20.70 per 30 days).
* Deleting the deployment stops the charge. Uploaded files stay on the **Files** page and cost nothing.

## How It Works

1. **Upload** the expert, and any presets, indicators, libraries or data files it needs, on the project's [**Files**](#files) page.
2. Open the account, add the **Custom EA** feature and pick the expert, symbol, timeframe and optional preset.
3. When you save, MetaCopier transfers the files, starts a dedicated terminal, logs in to your broker and attaches the expert to the chart.
4. The state changes from **Starting** to **Running** as soon as the terminal confirms that the expert is loaded on the chart.
5. From then on, MetaCopier checks the expert continuously and restarts it automatically if it stops unexpectedly.

The expert trades on your account like it would on your own terminal. Trades it opens are normal account positions, so they appear in MetaCopier and can be copied to other accounts like any other trade.

## Files

The **Files** page of a project stores everything your experts need. A file uploaded there can be attached to an EA hosting deployment on any MetaTrader account of the project. You can upload a file with the upload button of its group or by dragging it onto the group.

| Group      | Extension               | Max size | Purpose                                         |
| ---------- | ----------------------- | -------- | ----------------------------------------------- |
| Experts    | `.ex5` / `.ex4`         | 8 MB     | The compiled robot a deployment runs            |
| Indicators | `.ex5` / `.ex4`         | 8 MB     | Custom indicators the expert calls              |
| Libraries  | `.ex5` / `.ex4`         | 8 MB     | Shared code the expert imports at runtime       |
| Presets    | `.set`                  | 64 KB    | Input sets you can pick per deployment          |
| Data       | `.csv`, `.txt`, `.json` | 4 MB     | Files the expert reads from the terminal folder |
| DLL        | `.dll`                  | 16 MB    | Native libraries, only after a staff review     |

* **Storage:** Each project has **100 MB** of storage. The storage bar at the top of the page shows how much is used. Switch on **Unused only** to see which files no deployment references any more.
* **Versions:** Uploading a file with the same name but different content creates a **new version**. The old version is kept, so running deployments are not affected. Uploading identical content again does not create a new version. A file name can have up to **20 versions**.
* **Delete:** A file version that a deployment still uses cannot be deleted. Remove it from the deployment first. Under **Used by**, each file shows the account and the deployment that use it.
* **Reserved names:** File names starting with `mc_` and a few internal names are reserved and cannot be uploaded.
* **Presets and data files** must be text. Upload presets exactly as MetaTrader saved them: MT5 saves them as UTF-16 and MT4 as ANSI, and both are accepted, as is UTF-8.

{% hint style="info" %}
Deleting an EA hosting deployment never deletes its files. Uploaded files cost nothing.
{% endhint %}

### DLLs

DLL import is **switched off** on hosted terminals. An expert that needs a DLL can only be deployed after a **source review** by our staff. Both the expert and every DLL it loads must pass the review. The review can take **up to 2 weeks**. Contact support if your expert needs DLL access.

On the Files page, a reviewed DLL is marked as **Source reviewed by staff**. A DLL that is still awaiting review cannot be attached to an expert and is shown as **Not reviewed** in the feature dialog. Uploading a new version of a DLL requires a new review.

The DLL must match the platform: **64-bit** for MT5, **32-bit** for MT4.

## Settings

* **Expert advisor:** The compiled expert to run. Only files matching the account platform are listed, because an `.ex4` cannot load on MT5 and vice versa. Each entry shows the version, and the newest version of a file is marked **latest**. The deployment stays on the selected version, even if you upload a newer one later. To update the expert, upload the new version and select it here.
* **Symbol:** The chart symbol the expert runs on, exactly as your broker names it (e.g. `EURUSD`, `EURUSD.pro`). In a template, the symbol is entered manually.
* **Timeframe:** The chart timeframe.
  * **MT5:** M1, M2, M3, M4, M5, M6, M10, M12, M15, M20, M30, H1, H2, H3, H4, H6, H8, H12, D1, W1, MN1
  * **MT4:** M1, M5, M15, M30, H1, H4, D1, W1, MN1
* **Inputs preset (.set):** The input parameters of the expert. Create the file in MetaTrader with **Save** in the expert's **Inputs** dialog and upload it on the Files page. Without a preset, the expert runs with its compiled default inputs.
* **Companion files:** Indicators, libraries and data files the expert loads at runtime. Upload them on the Files page first, then add them here. MetaCopier places each file in the matching MetaTrader folder (`Indicators`, `Libraries` or `Files`). A preset is not a companion file; pick it under **Inputs preset** instead. Up to **20** companion files are allowed, and all files of a deployment together, including the expert, may not exceed **32 MB**.
* **Live trading:** If switched off, the terminal rejects all orders of the expert. Use this for a dry run.
* **Running:** Switch off to stop the expert and its terminal without deleting the deployment. It stays stopped until you switch it on again. The daily charge continues while the deployment exists.
* **Experts enabled:** The terminal's master switch for experts. If switched off, the expert does not run.
* **WebRequest URLs:** Not supported yet. Leave the field empty. An expert that calls `WebRequest()` cannot be hosted at the moment.

{% hint style="info" %}
Every change to the settings restarts the expert's terminal so the new configuration takes effect. Positions stay open during the restart.
{% endhint %}

## Limits

* **Experts per account:** 5
* **Experts per project:** 25. Contact support if you need more.
* **Resources per terminal:** Every hosted terminal may use up to **40 % of one CPU core** (0.4 vCPU) and **400 MB memory**. CPU is measured as a share of one core, so 100 % means one full core. Windows Task Manager shows CPU as a share of all cores instead, so the same load appears much lower there. The status view warns you once an expert reaches half of the limit. An expert that stays above the limit is stopped with **Resource budget exceeded**. This usually points to an endless loop or to arrays and history data that keep growing.

## Status and logs

Open the EA hosting feature of an account and click **Status and logs**. You can also open it from the **Expert Advisors** overview on the Accounts page.

### States

| State        | Meaning                                                                    |
| ------------ | -------------------------------------------------------------------------- |
| **Starting** | The terminal is starting, logging in to the broker and loading the expert. |
| **Running**  | The terminal confirmed that the expert is loaded on the chart.             |
| **Error**    | The expert stopped. The reason is shown in the status view.                |
| **Stopped**  | The expert is not running.                                                 |

### Status

* **State:** The current state (see above).
* **Broker:** Whether the terminal is **Connected** to your broker.
* **Expert:** Whether the expert is **Loaded** on the chart.
* **Uptime:** How long the expert has been running since the last start.
* **CPU** and **Memory:** The current usage of the terminal, CPU as a share of one core, including a warning when it gets close to the limit.
* **Restarts:** How often the expert was restarted automatically.
* **Last lifesign:** When the terminal last reported.

If the expert is in an error state, the reason is shown in an alert above the logs.

### Logs

The log view shows the logs of the hosted terminal, just like the **Journal** and **Experts** tabs in your own MetaTrader.

* **Source:**
  * **Expert:** What the expert prints (`Print()`, `Alert()`, errors from `OnInit`, trade results and so on). This is the log you usually need to debug an expert.
  * **Terminal:** The terminal journal (broker connection, expert loading, trade requests).
  * **Both:** Both logs on one timeline.
* **Follow:** Automatically loads new lines every few seconds. Click **Pause** to stop following.
* **Reload:** Loads the latest lines again.
* **Download:** Downloads the full retained log history as a text file.

The log view only shows the most recent part of the history. Use **Download** for everything that is retained.

### Expert Advisors overview

If at least one expert is hosted in the project, the **Accounts** page shows an **Expert Advisors** panel. It lists every hosted expert with its state, account, expert name, symbol, timeframe, CPU and memory usage, the number of automatic restarts and the last error. The header shows how many experts are in each state. Click an expert to open its status and logs.

## Automatic restarts

If an expert stops unexpectedly, for example because the terminal lost its connection or the expert was removed from the chart, MetaCopier restarts it automatically. Repeated failures are retried with an increasing delay of **1, 2, 5 and then 15 minutes**.

The same applies to the broker connection: if the terminal is disconnected from your broker and does not reconnect by itself within **3 minutes**, the terminal is restarted. Meanwhile, the **Expert Advisors** overview on the Accounts page shows **Broker disconnected**.

Errors that a restart cannot fix are **not** retried, so the expert stays in the error state until you fix the cause:

* the expert file is not valid for the platform
* the expert needs DLL access
* the account credentials are wrong
* a companion file is missing
* the symbol does not exist at the broker
* the expert exceeded the resource limits

Fix the cause and save the feature again to restart the expert.

## Troubleshooting

| Message                                                                                | What to do                                                                                                                                                                                                  |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The terminal refused the expert advisor file.                                          | The file was compiled for the other MetaTrader version or is damaged. Upload the `.ex5` for MT5 or the `.ex4` for MT4.                                                                                      |
| The expert advisor is missing a file it needs.                                         | The expert calls a custom indicator, library or data file that is not attached. Check the **Expert** log for the file name, upload it and add it as a companion file.                                       |
| This expert advisor tries to load a DLL.                                               | DLL import is switched off. See [DLLs](#dlls).                                                                                                                                                              |
| The symbol is not valid.                                                               | Enter the symbol exactly as your broker names it, including any suffix.                                                                                                                                     |
| The terminal could not log in with these account credentials.                          | Check the login, password and server of the account.                                                                                                                                                        |
| The expert advisor used more CPU or memory than a hosted terminal is allowed to use.   | Check the expert for endless loops or data that keeps growing. See [Limits](#limits).                                                                                                                       |
| The expert advisor did not start within the expected time.                             | The terminal did not confirm the expert within 2 minutes. It is retried automatically. Check the **Terminal** log if it keeps happening.                                                                    |
| The hosting server stopped reporting for this expert advisor.                          | The expert is restarted automatically. No action is needed.                                                                                                                                                 |
| The terminal lost the connection to the broker and did not reconnect within 3 minutes. | The terminal is restarted automatically. If it keeps happening, check the **Terminal** log, check that the broker server of the account is still correct, and whether it is reachable or under maintenance. |
| No hosting capacity is free at the moment.                                             | Try again in a few minutes.                                                                                                                                                                                 |
| This file is still used by an expert advisor.                                          | A deployment still uses this file version. Remove it from the deployment, or select another version, before deleting it.                                                                                    |
| This file could not be read as text.                                                   | Upload the preset exactly as MetaTrader saved it, without opening and re-saving it in another editor. Otherwise save it as UTF-8 and upload it again.                                                       |
| The storage limit of this project is reached.                                          | Delete files you no longer need. Switch on **Unused only** on the Files page to find them.                                                                                                                  |
| This file already has the maximum number of versions.                                  | Delete an older version before uploading a new one.                                                                                                                                                         |
| This account already has the maximum number of hosted expert advisors.                 | Up to 5 experts per account are allowed. Delete one before adding another.                                                                                                                                  |

{% hint style="info" %}
If the expert loads but does not trade, check that **Live trading** and **Experts enabled** are switched on, and look at the **Expert** log for trade errors returned by the broker.
{% endhint %}
