Howto retreive the details of the last open order
if(OrderSymbol()==0||OrderSymbol()==1) break;
??????
OrderSymbol() is a string.
DOHHHHHH
Thanks Keith, it must be the quarantine;)
I have tried this and unfortunately it still does not work 100%
It returns me the GBPCAD order highlighted when I am expecting the last USDCHF
Any reasons?
for (int Counter=OrdersTotal()-1; Counter >= 0; Counter--) { OrderSelect(Counter, SELECT_BY_POS,MODE_TRADES); if(OrderType()==0||OrderType()==1) break; } string LastLiveOrd=OrderComment(); datetime LastDateLive=OrderOpenTime();

I have tried this and unfortunately it still does not work 100%
It returns me the GBPCAD order highlighted when I am expecting the last USDCHF
Any reasons?
When you return the list of orders, there's no guarantee of chronological order, so you need to confirm it yourself?
Something like this...
datetime lastorder=0; for(int i=0;i<OrdersTotal();i++) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderOpenTime()>lastorder) lastorder=OrderOpenTime();
It works like a charm!!!
Tx Andrew
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
PositionClose is not working - MQL5 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
Hi Everybody,
I am trying to retrieve the details of the last open order (i.e. not pending) , but the code below does not seem to work.
Any hints?
Thanks
MG