vdemydiuk / mtapi

MetaTrader API (terminal bridge)
http://mtapi4.net/
MIT License
521 stars 281 forks source link

MT5 Connect #132

Open gdreossi opened 5 years ago

gdreossi commented 5 years ago

Hello, I am unable to connect to MT5 Client using the following code:

MtApi5Client mtClient = new MtApi5Client(); mtClient.BeginConnect(8228);

Is there something missing? Is there any way to get connection error message?

Using the ApiService I am able to connect and get quotes:

MTApiService.MtClient client = new MTApiService.MtClient(8228); client.Connect(); List ff = client.GetQuotes();

Thank you.

KptKuck commented 5 years ago

Do you have the same problems with the Test Client? (MtApi5TestClient.exe)

guzuomuse commented 4 years ago

same question here @KptKuck @gdreossi have you solved it?

vdemydiuk commented 4 years ago

MtApi5Client has async function BeginConnect. For correct using the API you need to subscribe on event ConnectionStateChanged to get state of connection. When you receive state Mt5ConnectionState.Connected then you can use other functions like GetQuotes.

AlexR1998 commented 4 years ago

Can you solve that? I'm having the same problem