MT4在*.srv文件中包含服务器详细信息(地址和端口)。对于简单的应用程序,只需获得如下所示的主服务器就足够了
QuoteClient qc = new QuoteClient(2090221607, "OJgYhOfEF8", "demo.mt4tickmill.com", 443);
qc.Connect();
System.out.println("Connected. Balance = " + qc.AccountBalance());
1 void connectExtra() {
2 try {
3 Servers servers = QuoteClient.LoadSrv( "bin\\Debug\\GerchikCo-Demo.srv");
4 QuoteClient qc = Connect(servers.PrimaryServer, servers.SecondaryServers, 67611, "wx1yhpn");
5 System.out.println("Connected to server");
6 } catch (Exception ex){
7 System.out.println(ex.getMessage());
8 }
9 }
10
11 QuoteClient Connect(PrimaryServer primary , SecondaryServer[] slaves, int user, String password) {
12 System.out.println("Connecting...");
13 QuoteClient qc = new QuoteClient(user, password, primary.getHost(), primary.getPort());
14 try {
15 qc.Conne

最低0.47元/天 解锁文章
2824

被折叠的 条评论
为什么被折叠?



