# Adaptive Center of Gravity Oscillator

### Description

This study calculates and displays an Adaptive Center of Gravity Oscillator and Trigger Line for the data given by the Input Data Input. This study is an ACSIL implementation of the Indicator given in Figures 10.3 and 10.4 of the book Cybernetic Analysis for Stocks and Futures by John Ehlers.

Let $$X$$ be a random variable denoting the Input Data, and let $$X_t$$ be the value of $$X$$ at Index $$t$$. Let the Length and Median Phase Change Length Inputs be denoted as $$n_{CG}$$ and $$n_{Med}$$, respectively.

We first smooth the data using a Four Bar Symmetrical Finite Impulse Response Filter. The value of the smoothed data at Index $$t$$ is denoted as $$X^{(S)}_t$$, and we compute it as follows.

$$\displaystyle{X^{(S)}_t = \frac{1}{6}(X_t + 2X_{t - 1} + 2X_{t - 2} + X_{t - 3})}$$

Second, we compute the Cyber Cycle $$CC_t(X,n_{CC})$$.

Third, we compute the Dominant Cycle Period for $$CC_t(X,n_{CC})$$. Explicitly, we compute $$T^{(DC)}_t(CC(X,n_{CC}),n_{Med})$$. This is where the adaptive nature of the study comes from. The period is not static, but rather it changes with changing market conditions.

Finally, we denote the Adaptive Center of Gravity Oscillator as $$CG^{(A)}_t(X,n_{CG},n_{Med})$$, and we compute it as follows.

Define the Integer Period as $$T^{(Int)}_t(X,n_{CC},n_{Med}) = \left\lfloor{\frac{T^{(DC)}_t(CC(X,n_{CC}),n_{Med})}{2}}\right\rfloor$$. We will suppress the parameters of $$T^{(Int)}$$ in the following formula.

For an explanation of the floor function ($$\left\lfloor{\space\space}\right\rfloor$$), refer to our description here.

$$\displaystyle{CG^{(A)}_t(X,n_{CC},n_{Med}) = \left\{ \begin{matrix} -\frac{\sum_{j = 0}^{T^{(Int)}_t - 1} (1 + j)X_{t - j}}{\sum_{j = 0}^{T^{(Int)}_t - 1} X_{t - j}} + \frac{1}{2}(T^{(Int)} + 1) & \sum_{j = 0}^{n - 1} X_{t - j} \neq 0 \\ 0 & \sum_{j = 0}^{n - 1} X_{t - j} = 0 \end{matrix}\right .}$$

This study also displays a Center Line and the following Trigger Line.

$$Trig^{(ACC)}_t(X,n_{CC},n_{Med}) = CG^{(A)}_{t - 1}(C,n_{CC},n_{Med})$$