English

## how to check the number of orders

 51 giulioron 2010.04.13 00:40   hi guys only an advice: i need to check the number of pending order ( for the currency and for the type of order ) i have tried in this way: for (int i=0; i>>> no orders for this currency and this type order but it doesnt go. if i use total=ordertotal () i can check only the number of pending orders while i need to check that there is only one order type BUY for EUR USD . have u some suggestion?? similar
GBPJPY: The cross now faces further weakness after turning lower ahead of its key overhead resistance at 184.42 level during Thursday trading session. Our bias remains lower as long as that level remains unbroken. On the downside, support comes in at the 182.50 level where a violation will aim at the 182.
 47 farhang 2010.04.13 00:53 #   ```int NOofBuy=0; for(int i= OrdersTotal() - 1; i>=0; i--)       {     if(OrderSelect(i,SELECT_BY_POS)==true)     {    int Tip=OrderType();                    if (Tip==0)      {    NOofBuy++;          if (NOofBuy>1)          {          Alert("more than one buy orders open);          break;          }      }    } }```
 2567 Roger 2010.04.13 01:42 #   ```int x; for (int i=0; i
2029
gordon 2010.04.13 04:41 #

giulioron:

... i need to check the number of pending order ...

For pending orders u need to check that OrderType() is one of the following:

 OP_BUYLIMIT 2 Buy limit pending position. OP_SELLLIMIT 3 Sell limit pending position. OP_BUYSTOP 4 Buy stop pending position. OP_SELLSTOP 5 Sell stop pending position.

 51 giulioron 2010.04.13 12:12 #   first at all, thanks for support roger, for example, with your suggestion ```int x; for (int i=0; i
 Moderator1936 BarrowBoy 2010.04.13 13:19 #   G Check out this EA https://www.mql5.com/en/code/8714 for a function that counts by OrderType and OrderSymbol Good Luck -BB- similar
 51 giulioron 2010.04.14 00:15 #   barrow thanks but it doesnt solve my problem i have tried with the roger's suggestion ........... but when i check x=1 ======> for example buy with lot 0.2 x=2 ===> buy with lot 0.3 x=3 ==> buy with lot 0.4 seems that the program doesnt see the function x if i use x=ordertotal() ......it ìs ok but obviously i need to check also the currancy and the type of order have u an advice??? i can undestand which is the block similar
 1396 cloudbreaker 2010.04.14 12:30 #   Have you declared x as an integer before attempting to increment it? In other words do you have "int x" anywhere in your code? CB similar
 51 giulioron 2010.04.14 13:05 #   yes....i have put INT X at the beginning of program.... the problem is that i have to do something if x=1 or x=2 or x=3...
 2567 Roger 2010.04.15 00:06 #   ```int x; for (int i=0; i
 51 giulioron 2010.04.15 11:05 #   i will try again Roger. :-))))))))))) i continue to thanks u :-)) but i have just tried in similar way and it seems that the program doesnt recognize X=1 or X=2 .... i will inform u this evening similar