Don't want to buy/sell at levels already have open positions

 
/////////////////////////////////////////////////////////
chk_buy=0; chk_sell=0;
int totalorders = OrdersTotal();
for(int i=0;i<totalorders;i++)
{
OrderSelect(i, SELECT_BY_POS);
if ( OrderSymbol()==Symbol())
{ if ( (OrderType()==OP_BUY ||OrderType()==OP_BUYLIMIT) && OrderOpenPrice()==buy_order) chk_buy=1;

if ( (OrderType()==OP_SELL||OrderType()==OP_SELLLIMIT)&& OrderOpenPrice()==sell_order) chk_sell=1;

}
}
/////////////////////////////////////////////////////////

What's wrong with my script? I don't want the expert to buy or sell at levels which already have open position, and it doesn't seem to work. Anyone?
Reason: