for(int x=0;x<PositionsTotal();x++){ ulong ticket = PositionGetTicket(x); if(PositionSelectByTicket(ticket)){ string positionGetInteger_Type ; // switch syntax switch((int)PositionGetInteger(POSITION_TYPE)) { case 0:positionGetInteger_Type = "Buy Order";break; case 1:positionGetInteger_Type = "Sell Order";break; } /* // if else syntax if(PositionGetInteger(POSITION_TYPE)== 0){ positionGetInteger_Type = "Buy Order";} else {positionGetInteger_Type = "Sell Order";} */ Print(x," ", positionGetInteger_Type," ", PositionGetDouble(POSITION_PRICE_OPEN)," ", PositionGetString(POSITION_SYMBOL)," ", PositionGetSymbol(x)," ", PositionGetDouble(POSITION_PROFIT)," ", PositionGetTicket(x)); // OrdersTotal == Pending Orders , PositionGetxxx == Order exist } } for(int y=0;y<OrdersTotal();y++){ ulong tickets=OrderGetTicket(y); if(OrderSelect(tickets)) // OrdersTotal == Pending Orders , PositionGetxxx == Order exist Print(y,"<< arr ", (int)OrdersTotal(),"<< Total ", OrderGetTicket(y),"<< Ticket ", OrderGetString(ORDER_SYMBOL),"<< Symbol ", OrderGetDouble(ORDER_PRICE_OPEN),"<< PriceOpen ", "End" ); }
I think I have found the answer :) Thanks everyone
#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006 void OnStart() { for (int i = OrdersTotal() - 1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS)) OrderPrint(); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I would like to ask , how can I get into all pending orders ?
Thanks .