0% found this document useful (0 votes)
391 views

ZSCORE

The document discusses using z-scores as an indicator to analyze stock prices and trading opportunities. It explains how z-scores relate to Bollinger Bands and can be calculated from stock price data to measure how many standard deviations a stock's price is from its moving average. The document provides examples showing that stock prices touch the top or bottom Bollinger Band when the z-score reaches +2 or -2 standard deviations. It also discusses how smoothing the z-score using moving averages can identify potential trading signals.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
391 views

ZSCORE

The document discusses using z-scores as an indicator to analyze stock prices and trading opportunities. It explains how z-scores relate to Bollinger Bands and can be calculated from stock price data to measure how many standard deviations a stock's price is from its moving average. The document provides examples showing that stock prices touch the top or bottom Bollinger Band when the z-score reaches +2 or -2 standard deviations. It also discusses how smoothing the z-score using moving averages can identify potential trading signals.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Z-Score Indicator

10/29/02 09:27:44 AM PST


by Veronique Valcu

Here's another look at Bollinger Bands.


While researching for my math class, I came across z-score and its definition.
Suddenly, references to "mean" and "standard deviation" suggested a
possible relation with the well-known Bollinger Bands. Is there any other way
to look at these bands? Can trades be made using z-score as an indicator? I
decided to find out. In this article, I will try to respond to these questions.
The z-score (z) for a data item x measures the distance (in standard
deviations ) anddirection of the item from its mean ():

A value of zero indicates that the data item x is equal to the mean , while
positive or negative values show that the data item is above (x>) or below
(x<) the mean, respectively. Values of +2 and -2 show that the data item is
two standard deviations above or below the chosen mean, respectively, and
over 95.5% of all data items are contained within these two horizontal
references (see Figure 1).

Figure 1: Z-score indicator. Over 95.5% of all data are contained within +

and -2 standard deviations.


CALCULATION OF Z-SCORE
How can you apply this formula to stock prices? If you substitute x with the
closing price C, the mean with simple moving average (SMA) of n periods
(n), and with the standard deviation of closing prices for n periods, the
above formula becomes:

(Computation of z-score, using Excel and MetaStock, for a series of closing


prices, is explained in the sidebar, "Z-score calculation.")
HOW TO USE THE Z-SCORE INDICATOR
Once the indicator is defined, the question is "What is the relationship
between z-score and the well-known Bollinger Bands?" While Bollinger Bands
applied to closing prices are displayed as D standard deviations above and
below the mean, z-score shows how far the current closing price is from
these bands.
Figure 2 displays Bollinger Bands for closing prices (20 periods and two
standard deviations) and z-score for 20 days applied to the daily chart of the
Dow Jones Industrial Average (DJIA).

Figure 2: Bollinger Bands and z-score. When prices touch the bands, the zscore reaches +2 or -2 standard deviation levels.
As expected, whenever the price touches the top band, the z-score reaches
the +2. Conversely, when price touches the lower band, the z-score reaches
-2 standard deviation levels.
In Figure 3 (top chart) you see the z-score indicator applied to the Nasdaq
composite index. The horizontal levels at +2, 0, -2 offer a clear picture of
expected resistance and support levels, as they are equivalent with top
Bollinger Band, moving average, and bottom Bollinger Band, respectively.

Figure 3: Smoothing the z-score. This can result in very profitable trades.
Z-score applied to closing prices is an irregular curve that can be smoothed
by applying moving averages. In Figure 3 (bottom chart), a simple three-day
moving average has been applied to the z-score (20), and a simple five-day
moving average is applied to the resulting average.
As you can see, good long tradable moves took place at:
Point 1 (09/21/01 10/17/01)
Point 2 (2/25/02 3/12/02)
Point 3 (5/8/02 5/21/02)
Point 4 (8/8/02 8/23/02)
when the three-day simple moving average crossed above the five-day
simple moving average of the three-day simple moving average. Note there
are some good shorting opportunities initiated when the three-day simple
moving average crossed below the five-day simple moving average of the
three-day simple moving average (3/12/02, 04/22/02, 5/21/02, and 8/23/02).

CONCLUSIONS
The z-score indicator is not new, but its use can be seen as a supplement to
Bollinger Bands. It offers a simple way to assess the position of the price vis-vis its resistance and support levels expressed by the Bollinger Bands. In
addition, crossings of z-score averages may signal the start or the end of a
tradable trend. Traders may take a step further and look for stronger signals
by identifying common crossing points of z-score, its average, and average of
average.
In order to improve performance, traders can use different periods for the
bands together with other periods for the moving averages.
Veronique Valcu is a senior at the American School of Paris, France, with an
interest in the financial markets.
REFERENCES
Achelis, Steven B. [1995]. Technical Analysis From A To Z, Irwin Publishing.
Elder, Alexander [1993]. Trading For A Living, John Wiley & Sons.
Evens, Stuart P. [1999]. "Bollinger Bands," Technical Analysis of STOCKS &
COMMODITIES, Volume 17: March.
Murphy, John J [1999]. Technical Analysis Of Financial Markets, New York
Institute of Finance.
www.bollingerbands.com
www.animatedsoftware.com, Internet Glossary of Statistical Terms
www.thinkquest.org, ThinkQuest: Internet Challenge Library
TC2000 (data), MetaStock (Equis International)
SIDEBAR: Z-SCORE CALCULATION
The Z-score formula applied to closing prices is

In this example, n = 20 days, but other periods can be used.


Here is the calculation written for an Excel spreadsheet where n = 20 periods
(daily bars). Closing prices are shown in column B for the Nasdaq Composite

between July 1 and August 30, 2002.


In cell C21, compute the simple moving average for the first 20 closing
prices:
=Sum(B2:B21)/20
In cell D21, the use of the Excel function STDEVP (standard deviation)
defines the standard deviation of closing prices for the first 20 days:
=STDEVP(B2:B21)
In cell E21, insert the Z-score formula as:
=((B21-C21)/D21).
Copy formulas in C21, D21, and E21 down to the bottom of the last row of
the columns. The final Z-score results appear in column E. Values in this
column can be plotted easily to visualize the Z-score indicator.
You can download the spreadsheet here.
To create the same indicator using MetaStock 6.52, select Indicator Builder
from Tools, select "New," assign "Z-score" as Name and enter the following
code:
Periods:=Input("Enter Periods",5,21,20); {number of periods used, in this
case 20}
a := (C-Mov(C,Periods,S))/ Stdev(C,Periods ) ; {define Z-Score }
a; {plot Z-Score}

Definition of 'Z-Score'
How it's calculated

The Z-Score (sometimes called the standard score) is a statistical calculation.


Z-Score = (N*(R-.5)-X)/((X*(X-N))/(N-1))^(1/2)
where

N = The total number of trades in the sequence.

R = The total number of runs in the sequence.

X = 2*W*L

W = The total number of winning trades in the sequence.

L = The total number of losing trades in the sequence.

What it means
The Z score is the result of the runs test and will tell us if our system has more (or fewer) streaks of
consecutive wins and losses than a random distribution. The Z score shows us how many standard
deviations we are away from the mean of a distribution.
What we are trying to answer is how many streaks of wins (losses) can we expect from a given
system? Are the win (loss) streaks of the system we are testing in line with what we could expect? If
not, is there a high enough confidence limit that we can assume dependency exists between trades
-i.e., is the outcome of a trade dependent on the outcome of previous trades?
The Z score only takes into account the dependency from the point of view of whether the last trade
was a winner or a loser. It does not take into account the size of each winner or loser. For that we
use the Serial Correlation.

How can we profit from it?


The Z score tells the trader the tendency for a system to win or lose in streaks. Streaks are defined
by the times a system shifts between losing or winning trades. The Z score is calculated by
comparing the number of streaks there are in a set of trades with the number of streaks that could be
expected randomly. We can then transform this number into another value called the confidence
level which gives us a good idea of the relationship between wins and losses.

Use this table to translate the absolute Z Score to the confidence level:

Z-Score
3.00
2.58
2.33
2.17
2.05
2.00
1.96
1.64

Confidence Limit (%)


99.73
99.00
98.00
97.00
96.00
95.45
95.00
90.00

A confidence level of 95% or above is needed to exploit (for extra profit) the apparent nonrandomness of streaks in a system so based on this table we're looking for Z scores of above 1.96
and below -1.96.
A negative Z score means that there are fewer streaks in the trading system than would be expected
statistically. This means that winning trades tend to follow winning trades and that losing trades tend
to follower losers. A positive Z score means that there are more streaks in the trading system than
would be expected. This means that winners tend to follow losers and vice versa.
If you discover that the system that you have back tested or the system that you are currently trading
has a reasonable Z score then it is possible to exploit the system for extra profit using money
management techniques.

Further reading
If this subject interests you then we can recommend that you read more about this in The
Mathematics of Money Management: Risk Analysis Techniques for Traders by Ralph Vince. A
number of his ideas were used in the back testing system that we developed.

Z-Score
A Z-Score is a statistical measure. A Z-Score tells how a single data point compares to normal data.
A Z-Score says not only whether a point was above or below average, but how unusual the
measurement is.
The algorithm to compute a Z-Score is simple. Start with a list of numbers representing common
values for something. Compute the mean of this list. The mean is just a simple average. Then

compute the standard deviation of the list of numbers. The standard deviation is the average
distance between each number in the list, and the mean of the list. Now take a new number that you
want to compare to the list of numbers. Subtract the mean of the list from that number, then divide
the result by the standard deviation of the list. The final result will be the Z-Score of the new number
compared to the list of numbers.
The algorithm used to compute a Z-Score is almost identical to the algorithm used to compute
volatility. The difference is that a Z-Score only looks at the values of the normal data. Volatility also
looks at the order of the normal data.
Trade-Ideas uses Z-Scores and similar methods internally when evaluating market data. It is not
enough to know that a stock price is changing by a certain number of pennies or even a certain
percent. We always compare this to the normal fluctuations in the stocks price, to see how unusual
this even is. If the Z-Score is too low, we do not report an alert; we consider this to be noise. ZScores are often used in computing the stock specific filter values; larger Z-Scores lead to higher
quality alerts.

You might also like