If condition trade

 

  Dear programmers,

   I have a problem. I code an EA for open a trade when a bar straddle a band of IBands indicator. The problem is the EA is doing multiple tradings and I want to open

 only when first bar straddles the band then wait that price should come back between the bands, not to open every bar price straddles the band.

    I put if(OrdersTotal()>0 && OrderType()==MODE_BID)

   (!OrderSend... ) even if I use NOT it also trades. Some solution ? 

Reason: