# Broker onboarding

> Connect an account on any MT4 or MT5 broker, and what to do when we can't find the server.

Source: https://tickwire.io/docs/broker-onboarding/

You don't need a broker-specific integration. Any MT4 or MT5 broker works with the details below.

## What you provide

- `platform`: `mt4` or `mt5`
- `server`: the server name as shown in the terminal's login dialog, e.g. `YourBroker-Server`
- `login` and `password` (master to trade, investor to read only)

## MT5

The terminal finds brokers by server name through MetaQuotes' directory. That covers almost every
broker.

## MT4

MT4 has no central directory. We look up the broker's **public server address** from the server
name. If we can't resolve the name, give us the address from your broker's site.

## When the server isn't found

You get `E_SRV_NOT_FOUND` with suggestions:

```json
{
  "error": "ValidationError",
  "message": "Server not found: YourBroker-Srv. Suggested server names: YourBroker-Server",
  "details": { "code": "E_SRV_NOT_FOUND", "serversByBrokers": { "Your Broker Ltd": ["YourBroker-Server"] } }
}
```

If none fits, create a **provisioning profile** and upload the server file from a terminal where
login works: `servers.dat` from MT5's `Config` folder, or the broker's `.srv` file from MT4's
`config` folder.

```bash
curl -s -X POST "$TW/users/current/provisioning-profiles" -H "auth-token: $TW_KEY" \
  -H "content-type: application/json" \
  -d '{"name": "My broker", "version": 5, "brokerTimezone": "EET", "brokerDSTSwitchTimezone": "EET"}'

curl -s -X PUT "$TW/users/current/provisioning-profiles/$PROFILE/servers.dat" \
  -H "auth-token: $TW_KEY" -F "file=@servers.dat"
```

Then create the account with `provisioningProfileId`.

## Quirks we handle

- **Symbol suffixes.** `EURUSD` might be `EURUSDm` or `EURUSD.r`. `GET …/symbols` returns the exact
  names; use those.
- **Filling modes.** MT5 brokers accept different fill policies. We choose from the symbol's allowed
  modes, or you can give a priority list in `fillingModes`.
- **Same name, two platforms.** Some brokers use one server name for MT4 and MT5. The `platform`
  you set decides.
- **Cent and micro accounts.** Minimum volumes differ; read `minVolume` and `volumeStep` from the
  symbol specification.
- **Server time.** Measured per server, never assumed. See [Time zones](https://tickwire.io/docs/time-zones/).
