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

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian