# Technical Studies Reference

### Detrended Oscillator

This study calculates and displays a Detrended Oscillator for the Price Data.

Let $$C_t$$ be the value of the Close Price at Index $$t$$, and let $$n$$ be the Length Input. We define two quantities $$N^{(1)}(n)$$ and $$N^{(2)}(n)$$ and compute them as follows.

$$N^{(1)}(n) = \left\lfloor{\frac{n}{2}}\right\rfloor$$
$$N^{(2)}(n) = \left\lfloor{\frac{N^{(1)}(n)}{2}} + 1\right\rfloor$$

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

The Detrended Oscillator at Index $$t$$ is denoted as $$DO_t(n)$$, and it is computed in terms of a Simple Moving Average for $$t \geq n$$ as follows.

$$DO_t(n) = C_t - SMA_{t - N^{(2)}(n)}\left(C,N^{(1)}(n)\right)$$

Note: Depending on the setting of the Moving Average Type Input, the Simple Moving Average in the above formula could be replaced with an Exponential Moving Average, a Linear Regression Moving Average, a Weighted Moving Average, a Wilders Moving Average, a Simple Moving Average - Skip Zeros, or a Smoothed Moving Average.

This study also displays horizontal lines at levels determined by the Overbought Level and Oversold Level Inputs.