DEMA (Double exponential moving average) formula is

DEMA = ( 2 * EMA(n)) - EMA(EMA(n))

where n= period

The first step to calculating DEMA is to calculate the EMA. Then, run an EMA calculation again, using the result of the first EMA calculation (EMA(n) as a function of the equation EMA(x) ). Finally, subtract the result from the product of 2 * EMA(n).

Dema trading strategy is buy when DEMA crosses over EMA from below and

sell when DEMA crosses below EMA from above.

******************************

buy code :

SET A = EMA(CLOSE,9)

SET B = EMA(A,9)

SET C = (2 * A) - B

CROSSOVER(C,A)

**********************************

sell code :

SET A = EMA(CLOSE,9)

SET B = EMA(A,9)

SET C = (2 * A) - B

CROSSOVER(A,C)

********************************

the above code is not working