# Center of Gravity Oscillator

### Description

This study calculates and displays a 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 5.1 and 5.2 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 Input be denoted as \(n$$.

We denote the values of the Center of Gravity Oscillator and the Trigger Line for the given Inputs at Index $$t$$ as $$CG_t(X,n)$$ and $$Trig^{(CG)}_t(X,n)$$, respectively, and we compute them as follows.

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

$$Trig^{(CG)}_t(X,n) = CG_{t - 1}(X,n)$$

For an explanation of the Sigma ($$\Sigma$$) notation for summation, refer to our description here.