Buy EMA exit based on 30 EMA

Need Exit trades blocks.
Set 1 If Prev candle close below 30EMA exit from long if long trade running.
Set 2 If prev candle close above 30EMA exit from short if short trade running.