luminaryfi

Z-Score

luminaryfi Updated   
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
Release Notes:
avg => sma
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 a publication is governed by House Rules. You can favorite it to use it on a chart.

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.

Want to use this script on a chart?