In Pi when I have written a simple crossover code
Buy if
CROSSOVER(CLOSE, EMA(CLOSE, 100))
and sell if
CROSSOVER(EMA(CLOSE, 100), CLOSE )
It is generating Buy or Sell Signal the moment it crosses… It Should Do it on Close of the candle above that level.