OrdersTotal()

 

Hi all,


Trying to call this function to check no. of open buy orders...


When the code is called as a function from start() it always returns 0.

When the code is placed in start() at the same place as the call it always returns correctly...???


Any ideas?


TIA


LL



////////////////////////////////////////

int noOfBuyOrders()

{
int iLongCount=0;
int iOrdersTotal=OrdersTotal();
for(int i=iOrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
{
iLongCount++;
}
}

return(iLongCount);

}

///////////////////////////////////////

 
How do you call this function from start()?
 
Roger:
How do you call this function from start()?

int buyOrders = noOfBuyOrders();


TY

 

Replace

for(int i=iOrdersTotal()-1;i>=0;i--)

to

for(int i=iOrdersTotal-1;i>=0;i--)

 

lol Roger thanks!!!

such a numpty sometimes..


Looked at that code 10times today.. wrote it again then it worked, check it against other code... couldn't see a difference :-)


Thanks Again!!!