MQL5: Closed order detail
void lastclosedorder() { uint TotalNumberOfDeal = HistoryDealsTotal(); ulong Ticket = 0; long OrderType, DealEntry, Reason; string MySymbol = ""; double price = 0, stoploss = 0, target = 0; double ltp = iClose(Symbol(), PERIOD_CURRENT, 0); // Last tick price or market price // Persistent static array to store processed tickets static ulong ProcessedTickets[]; static int ProcessedTicketsCount = 0; HistorySelect(0, TimeCurrent()); // Select the history for the current time range for(uint i = 0; i < TotalNumberOfDeal; i++) { // Get the ticket ID if((Ticket = HistoryDealGetTicket(i)) > 0) { // Check if this ticket has already been processed if(IsTicketProcessed(Ticket, ProcessedTickets, Pr...