New signal not generated


I noticed an issue signal generation with my code.

Buy signal was triggered on May 26th 11:00 AM and I got stopped out at 14:10 PM the same day.
This can be seen below. StopLoss

Even though all my Buy conditions are satisfied (verified using the Explore option), the Buy Signal is not generated at May 27th 11:30 AM.

While looking for the reasons, I noticed that corresponding RAW Sell signal for May 26th 11:00 AM BUY, was at May 27th 12:35 PM.

The problem is new signal (Buy in this case) is not generated until the Sell Raw signal is generated. Please see the below image.Raw%20Signals

The code i was using is as below.

medma = EMA(C,50);
lngma = EMA(C, 200);

oslevel = 25;
oblevel = 75;
gapbetCandLMA = (C - lngma)*100/C;

//buy conditions
buycon1 = medma > lngma;
buycon2 = (gapbetCandLMA <= 0.4)  AND ((Ref(gapbetCandLMA, -1) > 0) AND (gapbetCandLMA > 0)); 
buycon3 = RSI(14) <=60  AND RSI(14) >= 30; 

//sell conditions
sellcon1 = (medma > lngma)  AND (RSI(14) >= oblevel);
sellcon2 = (RSI(14) >= oblevel) AND (lngma >medma); 

Buy = buycon1 AND buycon2 AND buycon3;
Sell = sellcon1 OR sellcon2; 

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

ApplyStop(stopTypeLoss, stopModePercent, 1, 1,False, 0, 0, -1, 0); // applying the stop loss of 1%
ApplyStop(stopTypeProfit, stopModePercent, 2.5, 1,False, 0, 0, -1, 0); // applying profit booking of 2%.. 

How can i tweak my code for new signals to generate after stop loss without missing them?

Thanks for the help.

Remove ExRem lines.
You don't need ExRem in analysis backtest anyway.

Thanks ... it worked.