Skip to content

MT4Account.ConnectByServerNameAsync method

Connects to the MT4 terminal using credentials provided in the constructor.

public Task ConnectByServerNameAsync(string serverName, string baseChartSymbol = "EURUSD", 
    bool waitForTerminalIsAlive = true, int timeoutSeconds = 30, DateTime? deadline = default, 
    CancellationToken cancellationToken = default)
parameter description
serverName MT4 server name from MT4 Terminal.
baseChartSymbol The base chart symbol to use (e.g., "EURUSD").
waitForTerminalIsAlive Whether to wait for terminal readiness before returning.
timeoutSeconds How long to wait for terminal readiness before timing out.

Return Value

A task representing the asynchronous connection operation.

Exceptions

exception condition
ApiExceptionMT4 Thrown if the server returns an error response.
RpcException Thrown if the gRPC connection fails.

See Also