## Using the z score to determine trade size and boost performance

##### 2019-01-11 11:08 forextraders

Suppose that we have a trading method which gives us great confidence, produces satisfactory results over a long time, and which refined through a long period of study and experimentation. We are aware of the risks of high leverage, and do not gamble by entering trades which do not fully meet our requirements. We are pleased with our results, but still unsure about how much we should risk. What can we do to solve this problem?

**What does a streak of wins or losses mean?**

One of the major issues with any trading method is the length and frequency of streaks of wins or losses. A win streak is a period during which consecutive gains are registered in an account, and a loss streak is the opposite. What kind of bearing do these series of wins and losses have for trade sizes? Obviously, if a style generates wins and losses in streaks, the results are not independent of each other. A profitable trade is suggesting the likelihood that there will be more gains in case the trader increases his position size. Conversely, if a loss warns us that it will be followed by more losses, and we should discard our original approach and seek our wealth at other occasions. In other words, heads in one flip tells us that following coin tosses will bring us more heads, and tails will lead to more tails in subsequent trials. This knowledge may allow us to increase the size of our position with reasonable confidence, or to eliminate it in the case of loss.

**The z-score**

Z-score is the mathematical tool used for calculating the capability of a trading system for generating wins and losses in streaks. The simple formula allows us to test our performance, and to check if the streaks generated present a random pattern or not. If the pattern is random, or at a non-significant confidence level, our results are independent of each other, and there’s no point in trying to scale in, or build up a position in successive trades. On the other hand, if our strategy is prone to generating streaks in a non-random fashion, we can use this knowledge to maximize our profits.

The formula of the z-score is

Z=(N*(R-0.5)-P)/((P*(P-N))/(N-1))^(1/2)

**where:**

N – total number of trades in a series (for example, in a string of (+++—-++—-++) we have 15 trades (++++), and the N is 15 )

R – total number of series of profitable and losing trades (if we have a run for our method, and we have a string of (+++—-++—-++), there are five series S1(+++), S2(—), S3(++), S4(—-), S5(++). So R is 5)

P = 2*W*L;

W – total number of profitable trades in the series;

L – total number of losing trades in the series.

A series is simply an unbroken string of wins or losses. For examples, (++++) is a series, as is (—), but (+-+) is not.

So all that we need to do, in order to understand if our strategy allows us to repeat our profits or losses in a non-random way, is to check its z-score, and to compare this to a series of numbers which we will call the confidence level. The confidence level is simply the normal distribution equivalent of the z-score we receive from our tests. If this sounds complicated, all that the trader needs to know is that in order to be considered suitable for profit maximization in money management methods our test must produce results that are greater than 1.96 or less than -1.96 (corresponding to the 95 percentile of normal distribution).

**Z-Score**

Confidence Limit (%) | |

3.00 | 99.73 |

2.58 | 99.00 |

2.33 | 98.00 |

2.17 | 97.00 |

2.05 | 96.00 |

2.00 | 95.45 |

1.96 | 95.00 |

1.64 | 90.00 |

Let's calculate the z-score for the above string of trades (+++—-++—-++).

Z=(N*(R-0.5)-P)/((P*(P-N))/(N-1))^(1/2)

Z=(15*(5-0.5)-112)/((112*(112-15))/(15-1))^(1/2)

Z=(-44.5)/27 = -1.64

We check the result on the above table and see that 1.64 corresponds to a 90 percent confidence level. This means that our results, while good, are not ideal in statistical terms, and we should be cautious in applying money management strategies to maximize our profits.

**An example with a good z-score.**

Below, we examine the case of a good z-score, and how it compares with an ordinary method.

Trade result | z-score strategist's action | Account Change in total
| Non z-score strategist's action | Account change in total |

+ | Buy, | +10 | Buy | +10 |

+ | Buy, high z-score suggests a string of gains | +20 | Buy | +20 |

+ | Buy | +30 | Buy | +30 |

– | Buy, z-score tells that our losses will follow each other, exit | +20 | Buy, cut losses, exit | +20 |

– | No action | +20 | No trade, | +20 |

– | Sell, | +30 | Buy, | +10 |

– | Sell, high z-score suggests a string of gains | +40 | No trade | +10 |

– | Sell | +50 | No trade | +10 |

– | Sell | +60 | No trade | +10 |

+ | Sell, z-score tells that our losses will follow each other, Exit | +50 | No trade | +10 |

+ | No action | +50 | Buy | +20 |

+ | Buy | +60 | Buy | +30 |

In this example we examine the hypothetical returns of two different traders, one of who employs a z-score strategy, while the other uses a simple scaling-in method. We also suppose that the string of trades are part of a larger sample that has a good enough z-score. The (+, or -) simplify the kind of trade that would return a profit in that period. For example, if the trader gives a buy order, and the trade is a +, or if the order is a sell, and the trade is a (-) the trader will have a profit. If the trader gives a sell order, and the trade is +, the result will be a loss.

As we see, the z-score trader has greater confidence in following up with his trades, because he expects them to concatenate losses and gains. If he sees a string of three gains, he is confident that he can continue betting in the same direction and expect a profit, and similarly, on seeing consecutive losses he's able to reverse direction or exit. The trader who doesn't use the z-score is not able to decide the direction of his bets with confidence, and he has difficulty in determining when to scale in, or stop. In our example, the z-score trader is able to gain double what his competitor gains due simply to the fact that he can build up his trades confidently.