MT5 History orders

easy direct connection to any MT4 and MT5 server

MT5 History orders

Here you can find how to get order history with MT5 API.

var api = new MT5API("45.76.194.231:443", 7371, "mt5api");
api.OnConnectStatus += ConnectionStatus;
api.Connect();
var from = DateTime.Now.AddDays(-10);
var to = DateTime.Now.AddDays(1);
api.RequestHistory(from, to);
Console.WriteLine("Waiting history...");
Thread.Sleep(5000);
foreach (var item in api.GetHistoryOrders(from, to))
    Console.WriteLine(item.Ticket + " " + item.Symbol + " " + item.DealType + " " + item.Profit);
Console.WriteLine("Press any key...");
Console.ReadKey();

Leave a Reply