invalid stops mql5

Amgad Samir Nassief Abdelmalek

Hello, I tried to upload an EA  for MT5 but I have errors (invalid stops)

I tried to modify codes

if (slB>Bid && slB<Ask)slB=Bid;
if (tpS>Bid && tpS<Ask)tpS=Bid;
if (slS<Ask && slS>Bid)slS=Ask;
if (tpB<Ask && tpB>Bid)tpB=Ask;


tpB is takeProfit foy buy position

tpS is takeProfit for sell position

slB is StopLoss for buy position

and slS is StopLoss for sell position

and all of them are put in position and modifications 


double Ask = NormalizeDouble(SymbolInfoDouble(SymbolArray[j],SYMBOL_ASK),_Digits);
double Bid = NormalizeDouble(SymbolInfoDouble(SymbolArray[j],SYMBOL_BID),_Digits);