Mistake in my code

 

I want to write a function, which do:

It must watch all pending or open orders in the chart, and if it is one of all orderSymbol which match a symbol in the chart, then nothing happens.

If all OrderSymbols don't match symbol in the chart, then do other function.

This is my code, but it doesn't do like I want.

When it is one chart and match OrderSymbol, function works fine. If more than one and all that Symbols match with OrderSymbols, the function founds only one chart.

"For" cycle must look for all Symbols. " If" condition looks for only first true condition, And if it met, it doesn't look again, so their mix, would do, what I want, but don't do, maybe it is a mistake, which I don't find.

int total = OrdersTotal();
if (total>0)
    {
     for(int i=total-1;i>=0;i--)
         {
         if( OrderSymbol() != Symbol())
             My_function();
         }
    }
 

You'll have to check all orders first.

int total = OrdersTotal(); bool isSymFound;
if (total>0)
    {
     for(int i=total-1;i>=0;i--)
         {
         if( OrderSymbol() == Symbol() )
             isSymb=true; break;
         }
    }
if(isSymFound==false){My_function();}