PROTECTED SOURCE SCRIPT

Z-Scores

TLDR

Z-Scores ask "How many standard deviations is the current price, away from the moving average?"

Or put another way, it tells you how an asset is performing relative to its own moving average, centered about the zero-point.

INTRODUCTION

Z-Scores are a fundamental statistical concept which take any dataset (in this case price), and present the data in terms of standard deviation. In the case of price, we're using *moving* standard deviations, much like we use a moving average.

A useful aspect of z-scores is that data oscillates around a zero point. The chart then presents the "number_of_standard_deviations" that price is, away from the moving average. So for example, if we're looking at the 100-day z-score, and the price = 0, that means that the current price is right at the 100-day moving average. If price = 1, that means that the price is 1 standard deviation above the 100-day moving average.

HOW DO I USE THIS?

This particular script offers a ribbon of z-scores (much like how you might have a ribbon of moving averages). You can enter up to 5 z-scores in the options. Enter "0" to remove a ribbon from the chart.

If you're a math nerd, you can also select "Use Log Transform," which effectively uses the geometric mean for z-score calculation. For charts that are rangebound, you dont really need this option, but for charts that are highly exponential, you might want to select this.

I've noticed that z-scores tend to behave similar to RSI. I prefer z-scores because they're a non-arbitrary, fundamental statistical concept, whereas the RSI calculation is somewhat arbitrary. I offer the z-score as a ribbon, because it removes the arbitrary nature of selecting one particular moving average [in other words *which* MA? ... 20 candles? 100? 500? ... etc]

PRACTICAL APPLICATION

Z-Score prices are akin to a momentum and/or trend indicator. They're useful for identifying a trending market, or trend reversals, before the actual price begins to reverse in earnest. The RSI concept of "divergence" can be applied. It can also be used to see how far out of trend a particularly violent movement up/down is, historically.

Another particularly useful aspect of z-scores, is comparing the performance of two different assets with very different price points. For example, maybe one chart is measured in cents, and another chart is measured in billions. Z-Scores normalize prices to a zero point, and normalize differing volatility by presenting it in terms of standard deviations. I use this for comparing things like in-asset-class performance, and also comparing various asset classes to others.

Remember, the z-score tells you how an asset is performing relative to its own moving average, centered about the zero-point.

CLOSING

I'm adding this to the public repository because there isnt a good z-score implementation here on TradingView, and especially not one that offers an adjustable ribbon like this. For the sharp eye, there is useful signal in z-scores, whether applied to a single asset, or to compare the performance of two assets against each other.
statisticsTrend AnalysisVolatility

Geschütztes Skript

Dieses Skript wird als Closed-Source veröffentlicht und Sie können es frei verwenden. Sie können es favorisieren, um es auf dem Chart zu verwenden. Sie können den Quellcode nicht einsehen oder verändern.

Möchten Sie dieses Skript auf einem Chart verwenden?

Haftungsausschluss