int ChecklimitedOrders16(int MagicNr)
What is the meaning of this number?
Could you show all of your code? It needs to be put into context for a proper solution.
above is all my code.
i want to count the open pending limit order. But the counting is wrong.

- www.mql5.com
add something like this:
int ChecklimitedOrders16(int MagicNr) { int TodayslimitedOrders = 0; for(int i=0; i<OrdersTotal(); i++) { string OrderSymbol = OrderGetString(ORDER_SYMBOL); int Magic = OrderGetInteger(ORDER_MAGIC); OrderSelect(OrderGetTicket(i)); if(OrderSymbol == Symbol()) if(Magic == MagicNr ) { ENUM_ORDER_TYPE type=(ENUM_ORDER_TYPE)OrderGetInteger(ORDER_TYPE); if(type==ORDER_TYPE_BUY_LIMIT || type==ORDER_TYPE_SELL_LIMIT) TodayslimitedOrders ++; } } return(TodayslimitedOrders); }
add something like this:
Thanks... But still not correct.
If no pending order, it say "0"
if 1 pending order open, it also say"0"
if 2 pending order open, it say"1"
the counting number is missing 1
Thanks... But still not correct.
If no pending order, it say "0"
if 1 pending order open, it also say"0"
if 2 pending order open, it say"1"
the counting number is missing 1
I thought you couldn't find how to count only limit oredrs, your initial function counts all pending's.
And last function only limit orders, perhaps you put stop orders and expecting that function will count this orders.

- www.mql5.com
I thought you couldn't find how to count only limit oredrs, your initial function counts all pending's.
And last function only limit orders, perhaps you put stop orders and expecting that function will count this orders.
But my code counting the order is not correct, keep missing "1"
do you know how to fix it?
string OrderSymbol = OrderGetString(ORDER_SYMBOL); int Magic = OrderGetInteger(ORDER_MAGIC); OrderSelect(OrderGetTicket(i));What symbol and magic do you expect to read when you haven't yet selected an order?
Perhaps you should read the manual.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
OrderGetString - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
But my code counting the order is not correct, keep missing "1"
do you know how to fix it?
For first, just take the example from faq.
//--- variables for returning values from order properties ulong ticket; double open_price; double initial_volume; datetime time_setup; string symbol; string type; long order_magic; long positionID; //--- number of current pending orders uint total=OrdersTotal(); //--- go through orders in a loop for(uint i=0;i<total;i++) { //--- return order ticket by its position in the list if((ticket=OrderGetTicket(i))>0) { //--- return order properties open_price =OrderGetDouble(ORDER_PRICE_OPEN); time_setup =(datetime)OrderGetInteger(ORDER_TIME_SETUP); symbol =OrderGetString(ORDER_SYMBOL); order_magic =OrderGetInteger(ORDER_MAGIC); positionID =OrderGetInteger(ORDER_POSITION_ID); initial_volume=OrderGetDouble(ORDER_VOLUME_INITIAL); type =EnumToString(ENUM_ORDER_TYPE(OrderGetInteger(ORDER_TYPE))); //--- prepare and show information about the order printf("#ticket %d %s %G %s at %G was set up at %s", ticket, // order ticket type, // type initial_volume, // placed volume symbol, // symbol open_price, // specified open price TimeToString(time_setup)// time of order placing ); } }
and put inside what do you need.
for what do you put the:
OrderSelect()
if
OrderGetTicket()
already make what we need.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I want to count the open pending order. But my code cannot count correctly, can anyone give me a help? Thanks