# Technical Studies Reference

- Technical Studies Reference
- Common Study Inputs (Opens a new page)
- Using Studies (Opens a new page)

# Murrey Math

This study calculates and displays Murrey Math Lines, which were developed by Thomas Henning Murrey.

The calculation is performed over a Square of fixed width. We denote the base value of the Square Width as \(n\), and this base value is modified by the **Multiplier** Input, which we denote as \(v\). The width of the Square is \([nv]\), where \([\cdot]\) denotes the Rounding Function. The value of \(n\) is determined as follows.

- If the
**Custom Square Width**Input is set to zero, then \(n\) is determined by the setting of the**Square Width**Input. The values of this Input are restricted to powers of \(2\), from \(4\) through \(512\). - If the
**Custom Square Width**Input is set to a nonzero value, then \(n\) is determined by this value. These values are not restricted to powers of \(2\).

The Square over which the calculations are performed begins at Index \(t_{start}\) and ends at Index \(t_{end}\). These are related via the equation \(t_{start} = t_{end} - [nv] + 1\), and \(t_{end}\) is determined by the Inputs as follows.

- If the
**Use Last Bar as End Date-Time**is set to Yes, then \(t_{end}\) is the Index of the last bar in the chart. - If the
**Use Last Bar as End Date-Time**is set to No, then \(t_{end}\) is the Index of the bar determined by the setting of the**End Date-Time**Input.

Let \(H\) and \(L\) be random variables denoting the High and Low Prices, respectively. We begin by computing the Highest High, Lowest Low, and Range over the Square. These are denoted as \(\max_{t_{end}}\left(H,[nv]\right)\), \(\min_{t_{end}}\left(L,[nv]\right)\), and \(\textrm{Range}_{t_{end}}(H,L,[nv])\). Note that these are not moving calculations; the calculations are performed **only** at Index \(t_{end}\).

Next we define a function \(SR_t(n,v)\), which we calculate at Index \(t_{end}\) as follows.

- If \(\max_{t_{end}}\left(H,[nv]\right) > 25\) and \(\displaystyle{\frac{\ln(0.4)\max_{t_{end}}\left(H,[nv]\right))}{\ln(10)} - \left\lfloor \frac{\ln(0.4)\max_{t_{end}}\left(H,[nv]\right))}{\ln(10)} \right\rfloor > 0}\), then \(\displaystyle{SR_{t_{end}}(n,v) = \exp\left(\ln(10)\left\lfloor \frac{\ln(0.4\max_{t_{end}}\left(H,[nv]\right))}{\ln(10)} \right\rfloor + 1\right)}\).
- If \(\max_{t_{end}}\left(H,[nv]\right) > 25\) and \(\displaystyle{\frac{\ln(0.4)\max_{t_{end}}\left(H,[nv]\right))}{\ln(10)} - \left\lfloor \frac{\ln(0.4)\max_{t_{end}}\left(H,[nv]\right))}{\ln(10)} \right\rfloor \leq 0}\), then \(\displaystyle{SR_{t_{end}}(n,v) = \exp\left(\ln(10)\left\lfloor \frac{\ln(0.4\max_{t_{end}}\left(H,[nv]\right))}{\ln(10)} \right\rfloor\right)}\).
- If \(\max_{t_{end}}\left(H,[nv]\right) \leq 25\), then \(\displaystyle{SR_{t_{end}}(n,v) = 100\exp\left(\ln(8)\left\lfloor \frac{\ln(0.005)\max_{t_{end}}\left(H,[nv]\right))}{\ln(8)} \right\rfloor\right)}\).

For an explanation of the logarithmic function \(\ln\), refer to our description here.

The Murrey Math Interval Range function is denoted as \(\textrm{Range}^{(MMI)}_{t_{end}}(n,v)\), and we calculate it at Index \(t_{end}\) as follows.

\(\displaystyle{\textrm{Range}^{(MMI)}_{t_{end}}(n,v) = \left. \ln\left(\frac{SR_{t_{end}}(n,v)}{\textrm{Range}_{t_{end}}(H,L,[nv])}\right) \middle/ \ln(8) \right.}\)Next we define a function called the Octave Count, dentoted as \(OC_t(n,v)\). We calculate this at Index \(t_{end}\) as follows.

- If \(\textrm{Range}^{(MMI)}_{t_{end}}(n,v) \leq 0\), then \(OC_{t_{end}}(n,v) = 0\).
- If \(\textrm{Range}^{(MMI)}_{t_{end}}(n,v) > 0\) and \(\displaystyle{\textrm{Range}^{(MMI)}_{t_{end}}(n,v) - \ln\left(\frac{SR_{t_{end}}(n,v)}{\textrm{Range}_{t_{end}}(H,L,[nv])}\right) + \ln(8)\left\lfloor \textrm{Range}^{(MMI)}_{t_{end}}(n,v) \right\rfloor = 0}\), then \(OC_{t_{end}}(n,v) = \left\lfloor \textrm{Range}^{(MMI)}_{t_{end}}(n,v) \right\rfloor\).
- If \(\textrm{Range}^{(MMI)}_{t_{end}}(n,v) > 0\) and \(\displaystyle{\textrm{Range}^{(MMI)}_{t_{end}}(n,v) - \ln\left(\frac{SR_{t_{end}}(n,v)}{\textrm{Range}_{t_{end}}(H,L,[nv])}\right) + \ln(8)\left\lfloor \textrm{Range}^{(MMI)}_{t_{end}}(n,v) \right\rfloor \neq 0}\), then \(OC_{t_{end}}(n,v) = \left\lfloor \textrm{Range}^{(MMI)}_{t_{end}}(n,v) \right\rfloor + 1\).

Next we define functions \(Si_t(n,v)\), \(M_t(n,v)\), \(I_t(n,v)\), \(B^{(+)}_t(n,v)\), and \(B^{(-)}_t(n,v)\), which we calculate at Index \(t_{end}\) as follows.

\(\displaystyle{Si_{t_{end}}(n,v) = SR_{t_{end}}(n,v)\exp(-\ln(8)OC_{t_{end}}(n,v))}\)For an explanation of the exponential function \(\exp\), refer to our description here.

\(\displaystyle{M_{t_{end}}(n,v) = \left\{ \begin{matrix} \left\lfloor \left. \ln\left|\frac{\textrm{Range}^{(MMI)}_{t_{end}}(n,v)}{Si_{t_{end}}(n,v)}\right| \middle/ \ln(2) \right. + 0.00001 \right\rfloor & \textrm{Range}^{(MMI)}_{t_{end}}(n,v) \neq 0 \\ 0 & \textrm{Range}^{(MMI)}_{t_{end}}(n,v) = 0 \end{matrix}\right .}\)

\(\displaystyle{I_{t_{end}}(n,v) = \frac{\frac{1}{2}=(\max_{t_{end}}(H,[nv]) + \min_{t_{end}}(L,[nv]))}{Si_{t_{end}}(n,v)\exp((M_{t_{end}}(n,v) - 1)\ln(2))}}\)

\(\displaystyle{B^{(+)}_{t_{end}}(n,v)} = (I_{t_{end}}(n,v) + 1)Si_{t_{end}}(n,v)\exp((M_{t_{end}}(n,v) - 1)\ln(2))\)

\(\displaystyle{B^{(-)}_{t_{end}}(n,v)} = (I_{t_{end}}(n,v) - 1)Si_{t_{end}}(n,v)\exp((M_{t_{end}}(n,v) - 1)\ln(2))\)

Finally, we are ready to calculate the **Murrey Math** Lines. These are enumerated using a Line Index \(\ell\), which takes on integer values from \(0\) to \(24\). The function used for calculating the lines is denoted as \(MML_t(n,v,\ell)\). To obtain the values of the Murrey Math Lines, we evaluate this function at \(t_{end}\) as follows.

The **Murrey Math** Lines are displayed as horizontal line segments between \(t_{start}\) and the current Index \(t\). The values of these Lines are rounded to the nearest **Tick Size** if the **Round to Tick Size** Input is set to Yes. See the Inputs section below.

The values of \(\ell\) correspond to the Octaves as follows.

\(\ell\) | Octave |
---|---|

\(0\) | \(-8/8\) |

\(1\) | \(-7/8\) |

\(2\) | \(-6/8\) |

\(3\) | \(-5/8\) |

\(4\) | \(-4/8\) |

\(5\) | \(-3/8\) |

\(6\) | \(-2/8\) |

\(7\) | \(-1/8\) |

\(8\) | \(0/8\) |

\(9\) | \(1/8\) |

\(10\) | \(2/8\) |

\(11\) | \(3/8\) |

\(12\) | \(4/8\) |

\(13\) | \(5/8\) |

\(14\) | \(6/8\) |

\(15\) | \(7/8\) |

\(16\) | \(8/8\) |

\(17\) | \(+1/8\) |

\(18\) | \(+2/8\) |

\(19\) | \(+3/8\) |

\(20\) | \(+4/8\) |

\(21\) | \(+5/8\) |

\(22\) | \(+6/8\) |

\(23\) | \(+7/8\) |

\(24\) | \(+8/8\) |

#### Inputs

**Square Width**: The width of the Square. In other words, the number of bars to use in the calculation. There is a list of preset choices. If you want to use a different width, then set this through the**Custom Square Width**Input setting instead. When**Custom Square Width**is set to a nonzero number, it overrides this**Square Width**Input setting.**Square Width Multiplier**: The default for this Input is 1.5. This value is multiplied with**Square Width**to increase the**Square Width**value.**Custom Square Width**: When this Input is set to a nonzero value, this overrides the**Square Width**Input and specifies the number of bars to use for the width of the Square. Normally this should be set to 0 unless you want to override**Square Width**.**Use Last Bar as End Date-Time:**If this is set to**Yes**, the Murray Math study will be calculated using the bars at the end of the chart. The Murray Math lines will be redrawn for every new bar added to the chart. If this Input is set to**No**, the Murray Math will be calculated using the bars beginning with the bar at the**End Date-Time**Input, and going back the number of bars specified with the**Square Width**Input. This Input is set to**Yes**by default.**End Date-Time:**The Date-Time which will be the last bar used in the calculation. The calculation will go back from this Date-Time the number of bars specified with the**Square Width**Input. By default, the**End Date-Time**Input is not set and will not be used unless the**Use Last Bar as End Date-Time**Input is set to**No**.**Round to Tick Size:**When this Input is set to**Yes**, then the Murray Math lines are rounded to the nearest**Tick Size**value which is set through**Chart >> Chart Settings**.

#### 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**.

*Last modified Wednesday, 28th September, 2022.