EMA crossover with differential value

(i) How to write code in tradescript when there is a EMA crossover & the following is also satisfied,

Buy / Sell when,

(EMA 1 - EMA 2) / EMA 1 > “X”.

Can the code base on the above be used in Scanner / EA functionality.

(ii) for the above requirement, which would serve the purpose better - Pi or Amibroker

As per the above given condition

SET A = EMA(CLOSE,1)
SET B = EMA(CLOSE,2)
(A-B)/A > LAST

please explain the condition in brief  ,Please specify "X" for?   it took X as Last Trading Price.

I want “X” to be defined as a specific value upto 4 decimal places (or) % upto 2 decimal place. “X” can be set as +ve or -ve value depending upon requirement. In a way, the value of X is like that of an oscillator. Like the option in Expert Advisor, can the value of X be picked post completion of candle.
Based on the present understanding, would be using the above strategy for scanning.
Any suggestions in developing this forward, would be welcome.