# Cycle Period

This study calculates and displays a Cycle Period for the data given by the Input Data Input. This study is an ACSIL implementation of the Indicator given in Figures 9.4 and 9.5 of the book Cybernetic Analysis for Stocks and Futures by John Ehlers.

### Support Function: Dominant Cycle Period

Before discussing this study, we first give the mathematical details of one of its support functions, namely sc.DominantCyclePeriod().

Let $$X$$ be any random variable, and let $$X_t$$ be the value of $$X$$ at Index $$t$$. Let $$n$$ denote a Length.

The function sc.DominantCyclePeriod computes the following quantities.

• The Quadrature Component, denoted as $$Q_t^{(1)}(X,n)$$
• The In-Phase Component, denoted as $$I_t^{(1)}(X,n)$$
• The Raw Phase Change, denoted as $$\Delta\phi_t^{(Raw)}(X,n)$$
• The Phase Change, denoted as $$\Delta\phi_t(X,n)$$
• The Median Phase Change, which is the $$n -$$ bar Moving Median of the Phase Change, and is denoted as $$\Delta\phi^{(Med)}_t(X,n)$$
• The Dominant Cycle, denoted as $$DC_t(X,n)$$
• The Instantaneous Period, denoted as $$T_t^{(Inst)}(X,n)$$
• The Dominant Cycle Period, denoted as $$T_t^{(DC)}(X,n)$$

These quantities are computed as follows.

$$Q_t^{(1)}(X,n) = (0.0962X_t + 0.5769X_{t - 2} - 0.5769X_{t - 4} - 0.0962X_{t - 6})\left(0.5 + 0.08*T^{(Inst)}_{t - 1}\right)$$

$$I_t^{(1)}(X,n) = X_{t - 3}$$

$$\displaystyle{\Delta\phi_t^{(Raw)}(X,n) = \left\{ \begin{matrix} \frac{\frac{I^{(1)}_t}{Q^{(1)}_t} - \frac{I^{(1)}_{t - 1}}{Q^{(1)}_{t - 1}}}{1 + \frac{I^{(1)}_t(X,n)I^{(1)}_{t - 1}(X,n)}{Q^{(1)}_t(X,n)Q^{(1)}_{t - 1}(X,n)}} & Q^{(1)}_t(X,n) \neq 0 \space and \space Q^{(1)}_{t - 1}(X,n) \neq 0 \\ 0 & otherwise \end{matrix}\right .}$$

$$\displaystyle{\Delta\phi_t(X,n) = \left\{ \begin{matrix} 1.1 & \Delta\phi_t^{(Raw)}(X,n) > 1.1 \\ \Delta\phi_t^{(Raw)}(X,n) & 0.1 \leq \Delta\phi_t^{(Raw)}(X,n) \leq 1.1 \\ 0.1 & \Delta\phi_t^{(Raw)}(X,n) < 0.1 \end{matrix}\right .}$$

$$\Delta\phi^{(Med)}_t(X,n) = MMed_t(\Delta\phi, n)$$

$$\displaystyle{DC_t(X,n) = \left\{ \begin{matrix} \frac{2\pi}{\Delta\phi_t^{(Med)}(X,n)} + 0.5 & \Delta\phi^{(Med)}_t(X,n) \neq 0 \\ 15 & \Delta\phi^{(Med)}_t(X,n) = 0 \end{matrix}\right .}$$

$$T^{(Inst)}_t(X,n) = 0.33DC_t(X,n) + 0.67T^{(Inst)}_{t - 1}(X,n)$$

$$T_t^{(DC)}(X,n) = 0.15T^{(Inst)}_t(X,n) + 0.85T_{t - 1}^{(DC)}(X,n)$$

$$T_t^{(DC)}(X,n)$$ is the return value of sc.DominantCyclePeriod().

### Main Study Function: Cycle Period

Let $$X$$ be a random variable denoting the Input Data, and let $$X_t$$ be the value of $$X$$ at Index $$t$$. Let the Cyber Cycle Length and Median Phase Change Length Inputs be denoted as $$n_{CC}$$ 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})}$$

We then compute the Cyber Cycle, $$CC_t(X,n_{CC})$$.

Finally, we apply the Dominant Cycle Period function defined above to the Cyber Cycle to obtain $$T_t^{(DC)}(CC(X,n_{CC}),n_{Med})$$. This is what is displayed as the Subgraph.