int GetTypeLastOpenPos(string sy="", int mn=-1) {
datetime t;
int i, k=OrdersTotal(), r=-1;
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if ((OrderSymbol()==sy || sy=="") && (mn<0 || OrderMagicNumber()==mn)) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (t<OrderOpenTime()) {
t=OrderOpenTime();
r=OrderType();
}
}
}
}
}
return(r);
}
I don't understand how to use it at all. How do I insert this code to get information about the order, that it is either Buy or Sell? I don't understand a thing.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Is it possible to replace metaeditor in mt4 with the one in mt5, it will be more convenient
In the new version the editor will be unified
Is it related to the "OrderType" function?
In the new version the editor will be unified
When will the new version be available, if that's not a secret?
How do I display information about the type of order?
Is it related to the "OrderType" function?
When will the new version be available, if that's not a secret?
Read a couple of the top threads. The titles speak for themselves
How do I insert this code to get information about the order, that it is either Buy or Sell?
I don't understand a thing.
I don't understand how to use it at all.
How do I put this code in to make sure it's either Buy or Sell?
It doesn't make any sense.
Show me how to do it, but insert the code in human form