Amjad_S

Mean Reversion Watchlist [Z score]

Hi Traders !

What is the Z score:

The Z score measures a values variability factor from the mean, this value is denoted by z and is interpreted as the number of standard deviations from the mean.

The Z score is often applied to the normal distribution to “standardize” the values; this makes comparison of normally distributed random variables with different units possible.

This popular reversal based indicator makes an assumption that the sample distribution (in this case the sample of price values) is normal, this allows for the interpretation that values with an extremely high or low percentile or “Z” value will likely be reversal zones.

This is because in the population data (the true distribution) which is known, anomaly values are very rare, therefore if price were to take a z score factor of 3 this would mean that price lies 3 standard deviations from the mean in the positive direction and is in the ≈99% percentile of all values. We would take this as a sign of a negative reversal as it is very unlikely to observe a consecutive equal to or more extreme than this percentile or Z value.

The z score normalization equation is given by


In Pine Script the Z score can be computed very easily using the below code.

// Z score custom function
Zscore(source, lookback) =>
    sma = ta.sma(source, lookback)
    stdev = ta.stdev(source, lookback, true)
    zscore = (source - sma) / stdev
    zscore

The Indicator:

This indicator plots the Z score for up to 20 different assets (Note the maximum is 40 however the utility of 40 plots in one indicator is not much, there is a diminishing marginal return of the number of plots).

Z score threshold levels can also be specified, the interpretation is the same as stated above.

The timeframe can also be fixed, by toggling the “Time frame lock” user input under the “TIME FRAME LOCK” user input group (Note this indicator does not repaint).
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?