# Technical Studies Reference

### Moving Average - Generalized Double Exponential

This study calculates and displays a Generalized Double Exponential Moving Average (GDEMA) of the data specified by the Input Data Input.

This study is closely related to the Exponential Moving Average (EMA), Double Exponential Moving Average (DEMA), and the T3 Moving Average (T3). Just as with DEMA and T3, we use the shorthand notation $$EMA_t^{(j)}(X,n)$$ to denote the $$j-$$fold composition of the EMA function with itself.

Let $$X$$ be a random variable denoting the Input Data, and let the Inputs Length, Multiplier, and GDEMA Count be denoted as $$n$$, $$v$$, and $$N$$, respectively.

We denote the Moving Average - Generalized Double Exponential at Index $$t$$ for the given Inputs as $$GDEMA^{(N)}_t(X,n,v)$$, and we compute it as follows.

For $$N = 1$$:

$$GDEMA^{(1)}_t(X,n,v) = (1 + v)EMA_t(X,n) - v EMA^{(2)}_t(X,n))$$

When $$v = 1$$, GDEMA is equivalent to DEMA.

In the following discussion, we will be taking advantage of the fact that the EMA function is linear. That is, for constants $$k_1$$ and $$k_2$$ and random variables $$X^{(1)}$$ and $$X^{(2)}$$, the following is true.

$$EMA_t\left(k_1 \cdot X^{(1)} + k_2 \cdot X^{(2)}\right) = k_1 \cdot EMA_t\left(X^{(1)},n\right) + k_2 \cdot EMA_t\left(X^{(2)},n\right)$$

For $$N = 2$$, we compose the GDEMA function with itself.

$$GDEMA^{(2)}_t(X,n,v) = GDEMA^{(1)}_t\left(GDEMA^{(1)}(X,n,v),n,v\right)$$
$$GDEMA^{(2)}_t(X,n,v) = v^2 EMA^{(4)}_t(X,n) - 2v(1+v)EMA^{(3)}_t(X,n) + (1 + v)^2 EMA^{(2)}_t(X,n)$$

For $$N = 3$$, we have the following.

$$GDEMA^{(3)}_t(X,n,v) = GDEMA^{(1)}_t\left(GDEMA^{(1)}\left(GDEMA^{(1)}(X,n,v),n,v\right),n,v\right)$$
$$GDEMA^{(3)}_t(X,n,v) = -v^3 EMA^{(6)}_t(X,n) + 3v^2(1 + v) EMA^{(5)}_t(X,n) - 3v(1 + v)^2 EMA^{(4)}_t(X,n) + (1 + v)^3 EMA^{(3)}_t(X,n)$$

Note that when $$N = 3$$, GDEMA is equivalent to T3.

In general, $$GDEMA^{(N)}_t(X,n,v)$$ is the $$N-$$fold composition of GDEMA with itself. Higher values of $$N$$ lead to more smoothing and more lag. The GDEMA subgraph is displayed for $$t \geq n\cdot N$$.