Noah Mt4跟单系统制作第二篇 Mt4TradeApi连接服务器篇

372 阅读1分钟

Noah Mt4跟单系统制作第二篇 Mt4TradeApi连接服务器篇

using System;
using Mt4TradeApi;
 
namespace Demo
{
  class Program
  {
    static void Main(string[] args)
    {
      new Program().Run();
    }
 
    void Run()
    {
      try
      {
        MainServer srv = QuoteClient.LoadSrv(@"abc.srv");
        QuoteClient qc = new QuoteClient(1000, "12345", srv.Host, srv.Port);
        Console.WriteLine("Connecting...");
        qc.Connect();
        Console.WriteLine("Connected to server");
        Console.WriteLine("Press any key...");
        Console.ReadKey();
        qc.Disconnect();
 
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message);
        Console.WriteLine("Press any key...");
        Console.ReadKey();
      }
    }
  }
}

NoahWork