# Function that returns ONLY market orders count. Please

50

Hi,

Is there a function returning ONLY the market orders count, Please

TIA

Best regards

BBF

628

BIGBLACKFEET:

Hi,

Is there a function returning ONLY the market orders count, Please

TIA

Best regards

BBF

50

ggekko wrote >>

Thanks for trying to help... but this function return market orders count AND pending orders count.

I'm interested for a function that returns the market orders count ONLY.

Best regards

BBF

327

Hi,

No there is no such function. You have to make a loop counting the orders you want to count, according to the TYPE to select wether it is a pending order or not.

I give you an idea of what I mean:

```int MarketOrderCount()
int curOrder, numOrders = OrdersTotal();
for(curOrder = 0; curOrder < numOrders; curOrder++)
{// GET ORDER
if (!GetOrderByPos(curOrder))
return(9999);
// GET ORDER OK
if (OrderType() != OP_BUY  &&  OrderType() != OP_SELL)  // no pending orders will be treated
//(or test with other OP_ options depending on your
//treatments)
}
}

Check this out, I just wrote it like that not even compiled it.```
628

BIGBLACKFEET:

Thanks for trying to help... but this function return market orders count AND pending orders count.

I'm interested for a function that returns the market orders count ONLY.

Best regards

BBF

Ok, here you are:

```  int c = 0;
int total  = OrdersTotal();

for (int cnt = 0 ; cnt < total ; cnt++)
{
{
c++;
}
}

```
Cheers
1758

BBF

Something like this...

```int OpenTradesForMNForType(int iMN, int iType)
{
// Call as example

int icnt, itotal, retval;

retval=0;
itotal=OrdersTotal();

for(icnt=0;icnt<itotal;icnt++)
{
// check for opened position & MagicNumber
if((OrderType()==iType) && (OrderMagicNumber()==iMN))
{
retval++;
}

}

return(retval);
}```

Good Luck

-BB-

50

BarrowBoy wrote >>

BBF

Something like this...

Good Luck

-BB-

Hi,

ggekko, jacques366, and you BarrowBoy, all of you, you have been quite nice... and efficient.

Great indeed

Thanks again

Best regards

BBF