EMA cross over with target

Could you please get me the code for the below strategy;

  1. Buy signal “when candle is closed above the EMA 10 line, and candle should close on 1st or 2nd candle’s high. + Exit Target is 0.5%

  2. Sell signal "When candle is closed below the EMA 10 line, and candle should close the 1st and 2nd candle’s Low. + Exit Target is 0.5%

Thanks in advance

As per the above condition

Buy Script:

CLOSE > EMA(CLOSE,10) AND REF(CLOSE,1) > EMA(CLOSE,10) AND REF(CLOSE,2) > EMA(CLOSE,10) 

Sell Script:

CLOSE < EMA(CLOSE,10) AND REF(CLOSE,1) < EMA(CLOSE,10) AND REF(CLOSE,2) < EMA(CLOSE,10) 

exit targets based on percentages is not possible

Thanks a bunch…