bool variable to check opened orders

 

I’m trying to write a boolean variable that is true when no orders are opened on the current Symbol().

I receive the error “too complex expression”.

Bool Opened = for(cnt=0;cnt<=total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

OrderSymbol()!=Symbol() // check for symbol

}

How can I adjust?

Thank you!

 

This is the right solution


Num_Order = 0;
for(cnt=0;cnt<=total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol()==Symbol() ) // check for symbol
{
Num_Order++;
}
}

In this way there's no need to reset the variable Num_Order.

Reason: