OPEN-SOURCE SCRIPT

STD-Filtered Jurik Volty Adaptive TEMA [Loxx]

Updated
The STD-Filtered Jurik Volty Adaptive TEMA [Loxx] is an advanced moving average overlay indicator that incorporates adaptive period inputs from Jurik Volty into a Triple Exponential Moving Average (TEMA). The resulting value is further refined using a standard deviation filter to minimize noise. This adaptation aims to develop a faster TEMA that leads the standard, non-adaptive TEMA. However, during periods of low volatility, the output may be noisy, so a standard deviation filter is employed to decrease choppiness, yielding a highly responsive TEMA without the noise typically caused by low market volatility.

█ What is Jurik Volty?
Jurik Volty calculates the price volatility and relative price volatility factor.

The Jurik smoothing includes 3 stages:
1st stage - Preliminary smoothing by adaptive EMA
2nd stage - One more preliminary smoothing by Kalman filter
3rd stage - Final smoothing by unique Jurik adaptive filter

Here's a breakdown of the code:
1. volty(float src, int len) => defines a function called volty that takes two arguments: src, which represents the source price data (like close price), and len, which represents the length or period for calculating the indicator.
2. int avgLen = 65 sets the length for the Simple Moving Average (SMA) to 65.
3. Various variables are initialized like volty, voltya, bsmax, bsmin, and vsum.
4. len1 is calculated as math.max(math.log(math.sqrt(0.5 * (len-1))) / math.log(2.0) + 2.0, 0); this expression involves some mathematical transformations based on the len input. The purpose is to create a dynamic factor that will be used later in the calculations.
5. pow1 is calculated as math.max(len1 - 2.0, 0.5); this variable is another dynamic factor used in further calculations.
6. del1 and del2 represent the differences between the current src value and the previous values of bsmax and bsmin, respectively.
7. volty is assigned a value based on a conditional expression, which checks whether the absolute value of del1 is greater than the absolute value of del2. This step is essential for determining the direction and magnitude of the price change.
8. vsum is updated based on the previous value and the difference between the current and previous volty values.
9. The Simple Moving Average (SMA) of vsum is calculated with the length avgLen and assigned to avg.
10. Variables dVolty, pow2, len2, and Kv are calculated using various mathematical transformations based on previously calculated variables. These variables are used to adjust the Jurik Volty indicator based on the observed volatility.
11. The bsmax and bsmin variables are updated based on the calculated Kv value and the direction of the price change.
12. inally, the temp variable is calculated as the ratio of avolty to vsum. This value represents the Jurik Volty indicator's output and can be used to analyze the market trends and potential reversals.

Jurik Volty can be used to identify periods of high or low volatility and to spot potential trade setups based on price behavior near the volatility bands.

█ What is the Triple Exponential Moving Average?
The Triple Exponential Moving Average (TEMA) is a technical indicator used by traders and investors to identify trends and price reversals in financial markets. It is a more advanced and responsive version of the Exponential Moving Average (EMA). TEMA was developed by Patrick Mulloy and introduced in the January 1994 issue of Technical Analysis of Stocks & Commodities magazine. The aim of TEMA is to minimize the lag associated with single and double exponential moving averages while also filtering out market noise, thus providing a smoother, more accurate representation of the market trend.

To understand TEMA, let's first briefly review the EMA.

Exponential Moving Average (EMA):
EMA is a weighted moving average that gives more importance to recent price data. The formula for EMA is:

EMA_t = (Price_t * α) + (EMA_(t-1) * (1 - α))

Where:
  • EMA_t: EMA at time t
  • Price_t: Price at time t
  • α: Smoothing factor (α = 2 / (N + 1))
  • N: Length of the moving average period
  • EMA_(t-1): EMA at time t-1
  • Triple Exponential Moving Average (TEMA):


Triple Exponential Moving Average (TEMA):
TEMA combines three exponential moving averages to provide a more accurate and responsive trend indicator. The formula for TEMA is:

TEMA = 3 * EMA_1 - 3 * EMA_2 + EMA_3

Where:
  • EMA_1: The first EMA of the price data
  • EMA_2: The EMA of EMA_1
  • EMA_3: The EMA of EMA_2


Here are the steps to calculate TEMA:
1. Choose the length of the moving average period (N).
2. Calculate the smoothing factor α (α = 2 / (N + 1)).
3. Calculate the first EMA (EMA_1) using the price data and the smoothing factor α.
4. Calculate the second EMA (EMA_2) using the values of EMA_1 and the same smoothing factor α.
5. Calculate the third EMA (EMA_3) using the values of EMA_2 and the same smoothing factor α.
5. Finally, compute the TEMA using the formula: TEMA = 3 * EMA_1 - 3 * EMA_2 + EMA_3

The Triple Exponential Moving Average, with its combination of three EMAs, helps to reduce the lag and filter out market noise more effectively than a single or double EMA. It is particularly useful for short-term traders who require a responsive indicator to capture rapid price changes. Keep in mind, however, that TEMA is still a lagging indicator, and as with any technical analysis tool, it should be used in conjunction with other indicators and analysis methods to make well-informed trading decisions.

Extras
Release Notes
Updated plot output name.
adaptivejurikstdfilterstdsteppedsteppedTriple Exponential Moving Average (TEMA)volatilityadaptivevolty

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership
Also on:

Disclaimer