Noah Mt4跟单系统制作第六篇 Mt4TradeApi交易事件篇
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Mt4TradeApi;
namespace OrderEvent
{
class Program
{
static void Main(string[] args)
{
new Program().Run();
}
void Run()
{
try
{
MainServer srv = QuoteClient.LoadSrv(@"c:\\AbleCreationEnt-Demo.srv");
QuoteClient qc = new QuoteClient(1000, "123456", srv.Host, srv.Port);
qc.OnOrderUpdate += new OrderUpdateEventHandler(qc_OnOrderUpdate);
Console.WriteLine("Connecting...");
qc.Connect();
Console.WriteLine("Try to open/close trades on this account in MT4 terminal to see updates here. Press any key...");
Console.ReadKey();
qc.Disconnect();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Press any key...");
Console.ReadKey();
}
}
void qc_OnOrderUpdate(object sender, OrderUpdateEventArgs update)
{
Console.WriteLine(update.Action + " " + update.Order.Ticket);
}
}
}
NoahWork