Repeated Buy signals and unusual sell signals

Hello All,

I have system, which generates Buy-Sell signals based on few simple conditions as shown in the code below. For some odd reason, I am getting consecutive BUY signals (Green Triangle in Screenshot 1) despite having Exrem between BUY and SELL condition.

The second issue I have is with regard to SELL condition (Please see code below). Many a times, the conditions are clearly satisfied, yet there are no sell signals ( see screenshot 2) . Please help me to identify the in mistakes in my code.

Buy = trend == 1 AND finalCSum > EMA(finalCSum,EMALength) AND TimeNum() > entryTime AND TimeNum() < lastbuyTime; 
Sell = Cross(finalLSum,TrendSL) OR TimeNum() > sqroffTime;


If any more information is required, I will be happy to provide.

Screenshot1 Screenshot2


Unfortunately your question isn't clear enough and does not provide all necessary details to give you an answer (the formula that you sent does not produce chart that you posted) Please follow this advice: How to ask a good question