Login Page - Create Account

Technical Studies Reference


Moving Average - Block

This study calculates and displays a block moving average for the Price Data.

Let \(H\) and \(L\) be random variables denoting the High and Low Prices, respectively, and let \(H_t\) and \(L_t\) be their respective values at Index \(t\). Let the Average True Range Length, Box Multiplier 1, and Box Multiplier 2 Inputs be denoted as \(n\), \(v_1\), and \(v_2\), respectively. We introduce two functions Work Box Half 1 and Work Box Half 2, denoted as \(WBH_t^{(1)}(n)\) and \(WBH_t^{(2)}(n)\), and we compute them in terms of the Average True Range as follows.

\(WBH_t^{(1)}(n) = \frac{1}{2}v_1\overline{TR}_t(n)\)

\(WBH_t^{(2)}(n) = \frac{1}{2}v_2\overline{TR}_t(n)\)

Next we introduce eight other functions which are calculated in terms of \(WBH_t^{(1)}(n)\) and \(WBH_t^{(2)}(n)\). They are Direction 1, Direction 2, Top 1, Top 2, Middle 1, Middle 2, Bottom 1, and Bottom 2, which we denote respectively as \(Dir^{(1)}_t(n,v_1)\), \(Dir^{(2)}_t(n,v_2)\), \(Top^{(1)}_t(n,v_1)\), \(Top^{(2)}_t(n,v_2)\), \(Mid^{(1)}_t(n,v_1)\), \(Mid^{(2)}_t(n,v_2)\), \(Bot^{(1)}_t(n,v_1)\), and \(Bot^{(2)}_t(n,v_2)\). These functions are all equal to zero for \(t < n - 1\), and they are computed for \(t \geq n - 1\) as follows \((i = 1,2)\)

\(Dir^{(i)}_t(n,v_i) =\left\{ \begin{matrix} 1 & H_t > Top_{t - 1}^{(i)}(n,v_i) \\ -1 & L_t < Bot_{t - 1}^{(i)}(n,v_i) \space and \space H_t \leq Top_{t - 1}^{(i)}(n,v_i) \\ Dir^{(i)}_{n - 1}(n,v_i) & otherwise \end{matrix}\right .\)

\(Top^{(i)}_t(n,v_i) =\left\{ \begin{matrix} H_t & H_t > Top_{t - 1}^{(i)}(n,v_i) \\ Bot_t^{(i)}(n,v_i) + 2WBH_t^{(i)}(n) & L_t < Bot_{t - 1}^{(i)}(n,v_i) \space and \space H_t \leq Top_{t - 1}^{(i)}(n,v_i) \\ Top^{(i)}_{n - 1}(n,v_i) & otherwise \end{matrix}\right .\)

\(Mid^{(i)}_t(n,v_i) =\left\{ \begin{matrix} Top_t^{(i)}(n,v_i) - WBH_t^{(i)}(n) & H_t > Top_{t - 1}^{(i)}(n,v_i) \\ Bot_t^{(i)}(n,v_i) + WBH_t^{(i)}(n) & L_t < Bot_{t - 1}^{(i)}(n,v_i) \space and \space H_t \leq Top_{t - 1}^{(i)}(n,v_i) \\ Mid^{(i)}_{n - 1}(n,v_i) & otherwise \end{matrix}\right .\)

\(Bot^{(i)}_t(n,v_i) =\left\{ \begin{matrix} Top_t^{(i)}(n,v_i) - 2WBH_t^{(i)}(n) & H_t > Top_{t - 1}^{(i)}(n,v_i) \\ L_t & L_t < Bot_{t - 1}^{(i)}(n,v_i) \space and \space H_t \leq Top_{t - 1}^{(i)}(n,v_i) \\ Bot^{(i)}_{n - 1}(n,v_i) & otherwise \end{matrix}\right .\)

The Subgraphs that are displayed by Sierra Chart are the two Middle functions, \(Mid^{(i)}_t(n,v_i)\) \((i = 1,2)\), and they are colored as follows.

  • \(Dir^{(i)}_t(n,v_i) = 1 \Rightarrow\) Cyan
  • \(Dir^{(i)}_t(n,v_i) = -1 \Rightarrow\) Magenta

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.

Moving_Average_-_Block.433.scss


*Last modified Friday, 08th March, 2019.