Super Trend Stop

This study calculates and displays a Super Trend Stop for the Price Data. The calculation of this study is based on the Moving Median and the Average True Range. The Average True Range is calculated using the Hull Moving Average. This can be changed by appropriately setting the ATR Moving Average Type Input.

Let $$H_t$$, $$L_t$$, $$C_t$$, and $$P^{(HL)}_t$$ be the High, Low, Close, and High-Low Average Prices, respectively, at Index $$t$$. Let the ATR Multiplier, ATR Period, and Median Period Inputs be denoted as $$v$$, $$n_{\overline{TR}}$$, and $$n_M$$, respectively.

We define two functions: Trend and Stop. The values of these functions at Index $$t$$ are denoted respectively as $$Trend_t\left(v, n_{\overline{TR}}, n_M\right)$$ and $$Stop_t\left(v, n_{\overline{TR}}, n_M\right)$$. At $$t = 0$$, these functions are initialized as follows.

$$Trend_0\left(v, n_{\overline{TR}}, n_M\right) = 1$$
$$Stop_0\left(v, n_{\overline{TR}}, n_M\right) = C_0$$

For $$t > 0$$, these functions are calculated as follows.

• If $$C_t > Stop_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) = C_0$$:

$$Trend_t\left(v, n_{\overline{TR}}, n_M\right) = 1$$

$$\displaystyle{Stop_t\left(v, n_{\overline{TR}}, n_M\right) = \left\{ \begin{matrix} MMed_t\left(\overline{P}^{(HL)}, n_M\right) - v \cdot \overline{TR}\left(n_{\overline{TR}}\right) & Trend_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) < 0 \\ \max\left\{MMed_t\left(\overline{P}^{(HL)}, n_M\right) - v \cdot \overline{TR}\left(n_{\overline{TR}}\right), Stop_{t - 1}\left(v, n_{\overline{TR}}, n_M\right)\right\} & Trend_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) \geq 0 \end{matrix}\right .}$$
• If $$C_t < Stop_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) = C_0$$:

$$Trend_t\left(v, n_{\overline{TR}}, n_M\right) = -1$$

$$\displaystyle{Stop_t\left(v, n_{\overline{TR}}, n_M\right) = \left\{ \begin{matrix} MMed_t\left(\overline{P}^{(HL)}, n_M\right) + v \cdot \overline{TR}\left(n_{\overline{TR}}\right) & Trend_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) > 0 \\ \min\left\{MMed_t\left(\overline{P}^{(HL)}, n_M\right) + v \cdot \overline{TR}\left(n_{\overline{TR}}\right), Stop_{t - 1}\left(v, n_{\overline{TR}}, n_M\right)\right\} & Trend_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) \leq 0 \end{matrix}\right .}$$
• If $$C_t = Stop_{t - 1}\left(v, n_{\overline{TR}}, n_M\right) = C_0$$:

$$Trend_t\left(v, n_{\overline{TR}}, n_M\right) = Trend_{t - 1}\left(v, n_{\overline{TR}}, n_M\right)$$

$$Stop_t\left(v, n_{\overline{TR}}, n_M\right) = Stop_{t - 1}\left(v, n_{\overline{TR}}, n_M\right)$$

Inputs

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.