Login Page - Create Account

Technical Studies Reference


Demand Index

This study calculates and displays James Sibbet's Demand Index and its Simple Moving Average.

Let \(H\), \(L\), \(C\), and \(V\) be random variables denoting the High Price, Low Price, Closing Price, and Volume, respectively, and let \(H_t\), \(L_t\), \(C_t\), and \(V_t\) be their respective values at Index \(t\). We define the functions \(HL2C_t\) and \(Range_t\) as follows.

\(HL2C_t = H_t + L_t + 2C_t\)

\(\displaystyle{Range_t = \left\{ \begin{matrix} H_0 - L_0 & t = 0 \\ \max\{H_{t - 1}, H_t\} - \min\{L_{t - 1}, L_t\} & t > 0 \end{matrix}\right .}\)

Let the Buy/Sell Power Length Input be denoted as \(n_{BS}\). Then we denote the Exponential Moving Average of \(Range_t\) and \(V_t\) at Index \(t\) as \(\overline{Range}_t(n_{BS})\) and \(\overline{V}_t(n_{BS})\), respectively, and we compute them for \(t \geq 0\) as follows.

\(\overline{Range}_t(n_{BS}) = EMA_t(Range, n_{BS})\)
\(\overline{V}_t(n_{BS}) = EMA_t(V, n_{BS})\)

We denote the Buy Power and Sell Power at Index \(t\) as \(BP_t(n_{BS})\) and \(SP_t(n_{BS})\), respectively, and we compute them for \(t \geq 1\) as follows.

\(\displaystyle{BP_t(n_{BS}) = \left\{ \begin{matrix} \left. \left(\frac{V_t}{\overline{V}_t(n_{BS})} \right) \middle/ \exp\left(0.375\cdot\frac{HL2C_t + HL2C_{t - 1}}{H_0 - L_0}\cdot\frac{HL2C_{t - 1} - HL2C_t}{HL2C_t}\right)\right. & HL2C_t < HL2C_{t - 1} \\ \frac{V_t}{\overline{V}_t(n_{BS})} & HL2C_t \geq HL2C_{t - 1} \end{matrix}\right .}\)

\(\displaystyle{SP_t(n_{BS}) = \left\{ \begin{matrix} \frac{V_t}{\overline{V}_t(n_{BS})} & HL2C_t \leq HL2C_{t - 1} \\ \left. \left(\frac{V_t}{\overline{V}_t(n_{BS})} \right) \middle/ \exp\left(0.375\cdot\frac{HL2C_t + HL2C_{t - 1}}{H_0 - L_0}\cdot\frac{HL2C_t - HL2C_{t - 1}}{HL2C_{t - 1}}\right)\right. & HL2C_t > HL2C_{t - 1} \end{matrix}\right .}\)

Let the Buy/Sell Power Moving Average Length Input be denoted as \(n_{\overline{BS}}\). Then we denote the Exponential Moving Averages of the Buy and Sell Power as \(\overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right)\) and \(\overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right)\), respectively, and we compute them for \(t \geq 0\) as follows.

\(\overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) = EMA_t\left(BP\left(n_{BS}\right), n_{\overline{BS}}\right)\)
\(\overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) = EMA_t\left(SP\left(n_{BS}\right), n_{\overline{BS}}\right)\)

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

Next we define a Quotient function \(Q_t\left(n_{BS}, n_{\overline{BS}}\right)\) as follows.

\(\displaystyle{Q_t\left(n_{BS}, n_{\overline{BS}}\right) = \left\{ \begin{matrix} \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) / \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) & \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) > \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) \\ 1 & \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) = \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) \\ \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) / \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) & \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) < \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) \end{matrix}\right .}\)

Let the Demand Index Moving Average Length Input be denoted as \(n_{\overline{DI}}\). Then we denote the Demand Index and the Simple Moving Average of the Demand Index as \(DI_t\left(n_{BS}, n_{\overline{BS}}\right)\) and \(\overline{DI}_t\left(n_{BS}, n_{\overline{BS}}, n_{\overline{DI}}\right)\), respectively, and we compute them for \(t \geq n_{\overline{DI}}\) as follows.

\(\displaystyle{DI_t\left(n_{BS}, n_{\overline{BS}}\right) = \left\{\begin{matrix} 100\left(1 - Q_t\left(n_{BS}, n_{\overline{BS}}\right)\right) & \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) \leq \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) \\ 100\left(Q_t\left(n_{BS}, n_{\overline{BS}}\right) - 1\right) & \overline{SP}_t\left(n_{BS}, n_{\overline{BS}}\right) > \overline{BP}_t\left(n_{BS}, n_{\overline{BS}}\right) \end{matrix}\right .}\)

\(\overline{DI}_t\left(n_{BS}, n_{\overline{BS}}, n_{\overline{DI}}\right) = MA_t\left(DI\left(n_{BS}, n_{\overline{BS}}\right), n_{\overline{DI}}\right)\)

Note: The Simple Moving Average in the above formula is not affected by the setting of the Demand Index Moving Average Type Input.

Inputs

Spreadsheet

The spreadsheet below contains the formulas for this study in Spreadsheet format. Save this Spreadsheet to the Data Files Folder.

Open it through File >> Open Spreadsheet.

Demand_Index.139.scss


*Last modified Monday, 16th July, 2018.