getting previous orderType

 
How can I get the previous order type ? Is there such a build in function or sth. ?
 
ihsany87:
How can I get the previous order type ? Is there such a build in function or sth. ?
No, it's a complex process. You have to scan through the order history, find the last trade, and then read its type.
 
ihsany87:
How can I get the previous order type ? Is there such a build in function or sth. ?

With the way you write EA https://www.mql5.com/en/forum/139747 you probably clueless what is previous order type.

What do you mean by previous order type, anyway ?

 
dabbler:
No, it's a complex process. You have to scan through the order history, find the last trade, and then read its type.
Very complex.
int tickets[], nTickets = GetHistoryOrderByCloseTime(tickets);
if (nTickets > 0)
   if (!OrderSelect(tickets[0], SELECT_BY_TICKET)) // Last Closed.
        Alert("OrderSelect(", tickets[0], ") failed :", GetLastError());
   else{
      int previousOP = OrderType();
      :
   }
See Order History sort by closing date - MQL4 forum
 
I'm curious WHRoeder. In the code above, what is the meaning of the single ":".
 
MisterDog:
I'm curious WHRoeder. In the code above, what is the meaning of the single ":".

I think the idea is that you put other relevant code there of your own making.
 
dabbler:
I think the idea is that you put other relevant code there of your own making.
That makes sense. Kind of like a vertical version of "..." -- thanks.
Reason: