OPEN-SOURCE SCRIPT

Z-Score Weighted Moving Averages


Indicator: Z-Score Weighted Moving Averages
Another way of calculating moving average
This indicator calculates two types of weighted moving averages (WMAs) based on z-scores and inverse z-scores. The indicator's purpose is to provide traders with a unique perspective on price movements by assigning different weights to data points based on their deviations from the mean . The two types of WMAs generated are as follows:

Smoothed Weighted Moving Average (wma_smoothed):
Z-score is calculated as (price - SMA of price/(MAD*1.2533), where MAD is mean absolute deviation around the median).
Weights are assigned to each data point based on the inverse of (1 + absolute value of the z-scores). This emphasizes points closer to the mean and reduces the influence of extreme deviations.
The weighted moving average is computed using the calculated weights, giving more importance to data points with smaller z-scores and, therefore, points that are closer to the mean.

Dynamic Weighted Moving Average (wma_dynamic):
Z-scores are still calculated in the same way.
Weights are assigned based on the absolute value of the z-scores. This emphasizes data points with significant deviations from the mean, without considering the direction of deviation.
The weighted moving average is computed using these dynamic weights, giving more weight to data points that have larger absolute z-scores, irrespective of whether they are above or below the mean.
Moving Averages

Skript med en öppen källkod

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. Du kan ange den som favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?

Frånsägelse av ansvar