What's wrong with this code? (Trade once per bar)

 
   if (Bars != ThisBarTrade ) 
   ThisBarTrade = Bars;
   if(_AND && !__isExist(0))_Open_Position = OrderSend(Symbol(),0,_Arithmetic,MarketInfo(Symbol(),MODE_ASK),0,MarketInfo(Symbol(),MODE_ASK)-MarketInfo(Symbol(),MODE_POINT)*35,MarketInfo(Symbol(),MODE_ASK)+MarketInfo(Symbol(),MODE_POINT)*168,"RSI Buy",__STRATEGY_MAGIC + 0)>=0;
   if(_AND_2 && !__isExist(0))_Open_Position_2 = OrderSend(Symbol(),1,_Arithmetic,MarketInfo(Symbol(),MODE_BID),0,MarketInfo(Symbol(),MODE_BID)+MarketInfo(Symbol(),MODE_POINT)*35,MarketInfo(Symbol(),MODE_BID)-MarketInfo(Symbol(),MODE_POINT)*168,"RSI Sell",__STRATEGY_MAGIC + 0)>=0;
   return(0);

No errors but continues to open multiple trades when stopped out during signal bar. Any help would be much appreciated.

Cheers.

 

You don't instruct the EA to do anything if the condition is false and when the condition is true, it justs assigns a value to the variable ThisBarTrade

line 2 is conditional on line 1, then it will continue with the rest of the code

 
Your code
   if (Bars != ThisBarTrade ) 
   ThisBarTrade = Bars;
   : // every tick
Equivalent
   if (Bars != ThisBarTrade ) ThisBarTrade = Bars;
   : // every tick
Try
: // every tick
static datetime timeNow; datetime timePrev = timeNow; timeNow = Time[0];
if (timeNow != timePrev) {
   : // Once per bar
}
: // every tick
Don't use bars, if new history is downloaded, Bars changes. Don't use tick volume, you can miss ticks. Always use time. See also resetting statics
Reason: