Afl help need for current and next candle

Buy = When EMA 5 crosses above EMA 50
Sell = when EMA 50 Cross above EMA 5

I want buy or sell only at when it happening on the current candle or next candle only.
If buy or sell is not happening on current and next candle then order is not executed.

Can anybody to tell the solution of current and next candle condtion by afl code…