MT5 API Connect to server

easy direct connection to any MT4 and MT5 server

MT5 API Connect to server

You just need user, password and server address to esteblish connection with MT5 account.

void Run()
{
    var api = new MT5API("45.76.194.231:443", 7371, "mt5api");
    api.OnConnectStatus += ConnectionStatus;
    api.Connect();
    Console.WriteLine("Balance = " + api.Account.Balance);  
}

private void ConnectionStatus(MT5API sender, ConnectStatus e)
{
    Console.WriteLine(e);
}

After first connection with IP address or DNS name you can connect with server name.

var api = new MT5API("EvolveMarkets-MT5 Demo Server", 7371, "mt5api");

Second way more safe, because IP address of the server cuold be changed by broker.

You also can take servers.dat file from your MT5 Terminal and put it to ./config folder of your application and connect with server name as shown above.

To extract information from servers.dat file use our tool Dat2Srv.

Leave a Reply