OPEN-SOURCE SCRIPT
Updated

Z-Score

4 729
The z-score is a way of counting the number of standard deviations between a given data value and the mean of the data set.

Z-score = (x̄ - μ) / (σ / √ n)

x̄ = sample mean (using the array.avg function = array(a,close), where i = 1 to 21)
μ = population mean ( = avg(close, n))
σ = standard deviation of the population ( = stdev(close,n))
n = number of 'close' or trading day closes

n = input

... Note: The previous indicator is part of a larger series of indicators [statistical analysis of time series]
Release Notes
avg => sma

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.