Z-account or How to make a loss-making system profitable
In order to consider the trading system profitable, the mathematical expectation must be positive. Moreover, if your system has a negative expectation, no risk management method will help you. Strictly speaking, this is not entirely true - each rule has its own exceptions. And in this case, the exception is associated with the concept of Z - the account, which we will talk about today.
Today we will discuss how you can make a profitable system out of a loss-making system. As always, I promise to talk about complex things in a simple language, without integrals, derivatives, other mathematics and statistical theories.
In the article on the basics of risk management, we have examined the influence of the percentage of profitable transactions and the profit / loss ratio on the final result of trading in the system. We saw that the higher the ratio, the lower the percentage of profitable transactions and vice versa. At the same time, we concluded that it is important to find a balance between these two characteristics of the TS and considered different options for this balance and their influence on the general view of the balance growth chart.
To illustrate and remind you, I modeled in Excel a series of 300 transactions using the RAND function, and then multiplied the result of the function by the maximum profitable and unprofitable transaction. That is, in other words, I received 300 random transactions with profit or loss in the range from $ 300 to - $ 300 with a random percentage of winnings:
Now let's change the profit-to-loss ratio to 3 to 1:
Despite the fact that the percentage of profitable trades is still 50%, we got a much more interesting picture.
Moreover, the percentage of profitable trades is constantly changing over time. Below is a graph of the change in the percentage of profitable transactions over time:
I purposely missed the first 30 trades for a set of small statistics. As you can see, the percentage is not always exactly fifty. At the very beginning, it rose above 60%, but then, when receiving more data, it began to fluctuate near the average mark of 50% - sometimes a little higher (probably at this time the system showed the best result), sometimes a little lower (and then the system was losing funds, was in a drawdown).
What conclusions can be drawn from this simple exercise? First, the more data, the less fluctuation around the average mark. But this, I think, is understandable. Secondly, and most importantly, the number of profitable trades varies over time.
And now let's examine the very nature of these changes. If we toss a coin, then, as every student knows, each time we get completely independent results. That is, we always have a 50% chance of falling out of the tails with every new coin toss. Past events in such a system do not affect the future. Let's check it out.
Stripes of successes and failures when tossing a coin are a rather interesting phenomenon. There is an opinion that after six consecutive touchdowns of the coin with the eagle up, the probability that the tails will drop out for the seventh time increases significantly.
Then it turns out that if the tails fall three times in a row, then the probability that the next time the coin drops to the top of the eagle is 75%:100%/ 4 = 25% 100% - 25% = 75%
Consequently, the more throws, the smaller the number is subtracted from 100 percent. Following this logic, if the same side drops a hundred times in a row, this means that the probability that the next side will fall the other side is 100/101 = 0.99; 100 -0.99 = 99.01 percent. If this rule were observed in reality, then we would all be rich for a long time, playing in a casino.
The first time you flip a coin into the air, the probability of a tails falling is 50 percent. It is equally likely that the coin will land an eagle up. We flip a coin, and it falls to the top tails. Suppose now the chances of landing an eagle up are increasing. The mathematical arguments that usually supported this assumption are based on the fact that the next two landings will give the eagle for the first time, and the tails for the second. The coin is tossed, and tails again. Now we have such a distribution: 50% x 50% x 50% = 12.5%.
Such a train of thought mistakenly rests on a false axiom: the dependence of outcomes on each other. This means that the outcome of the next coin flip to some extent depends on the outcome of the previous coin flip. The determination of the dependence is revealed by the presence of influence or influence on the process of tossing from the outside from the outside. Independence means a complete lack of subordination to something or influence from any outside. In order for the number of identical outcomes following each other to affect the likelihood of a subsequent outcome, there must be a dependency. When tossing a coin, this dependence does not exist. The result of each coin toss is completely independent of any set of previous results.
At first glance, this seems impossible. For example, how many people will bet on the eagle if in 999.999 previous cases the tails fell out? Provided that no one specifically sends the coin, the probability of landing by the eagle should be 50/50, regardless of the result of 999.999 tosses, and it will always be 50/50. The following example confirms this view.
We will flip a coin twice. No more, no less. There are four possible outcomes of these two tosses:
All four alignments are equally probable. If there are only four options, then everyone accounts for 25 percent of the probability.
The first time you flip a coin, the tails drop out. In two distributions, the coin will be tiled first. As a result, two other possible options, in which the coin should have been dropped first by the eagle, become impossible. As a result, there are only two possible options. The sequence will be either tails-tails or tails-eagles.
In other words, the probability that an eagle will fall during the next toss is equal to the probability that a tails will fall. The previous outcome in no way affects the likelihood of the next outcome. This is a rule that is not related to the number of flips included in this example. If we are going to flip a coin four times, then there are 16 possible outcomes:
There can be no other outcomes. Before tossing a coin, it should be noted that each of these outcomes is equally likely at 6.25 percent (100/16). After the coin is flipped for the first time, eight of the possible hands are automatically excluded. If the first time the coin fell out in tails, then all options are excluded in which the coin should first fall out with an eagle. Thus, only the following eight options remain:
The probability of each option is 12.5 percent (100/8). In four of these eight options, the likelihood that a coin will go tails is 12.5 percent. At the same time, the remaining four options, in which the coin should be dropped by an eagle, also make up 12.5 percent. Thus, the probability of heads / tails remains at the level of 50 to 50 (12.5 x 4 = 50). After the next throw, four more options are excluded. If the next time the coin falls out again, then four out of the eight remaining options are excluded. Four layouts remain:
Each alignment has a 25 percent probability. In two of the four possible hands, an eagle may fall, while in the other two hands, the coin will land by tails. Thus, on the next throw, the probability is distributed equally between the eagle and the tails as before, in the ratio of 50 to 50. Next, the coin is tails again. Thus, only two options remain: p, p, p, o or p, p, p, p. And both outcomes have an equal 50 percent probability, since the results of previous throws do not exclude the possibility that the next time the coin will be dropped by an eagle, the same goes for tails.
That is why a sequence of 999,999 throws in which a coin falls only with an eagle or only with a tails does not increase the likelihood that the next time it drops out with the other side: respectively, tails or an eagle. Even if in 999.999 cases the coin went tails, there are only two possibilities for the coin to drop out this 1,000,000 times. The coin will be dropped either 999.999 times in a row tails and once an eagle, or 1,000,000 times tails. It can be either one or the other option and at the same time - with equal probability.
The relationship between past results and future
Dependence is the flip side of independence (no pun intended). The following example shows how dependence in reality increases likelihood. Suppose we have a deck of 20 cards. There is one ace of clubs in this deck. What is the probability that the first card taken at random will turn out to be a club ace? 1/20 = 5%.
The first card is a dozen tambourines. It is removed from the deck, and the total number of cards is reduced to 19. Thus, the probability that the next card will be an ace of clubs is 5.26315 (1/19 = 0.0526315).
The next card is a pure deuce. It is also removed from the deck, now the probability that the next ace of clubs will fall is 5.5555 percent. Another 8 cards are removed from the deck in the same way, and not one of them turns out to be an ace of clubs.
Now there are only 10 cards left. One of them is a ace of clubs, for all 10 cards the probability is the same as a club of ace until we take the next card from the deck. For her, the likelihood that she would turn out to be an ace of clubs increased to 10 percent.
If we extract 8 more cards from the deck and none of them turns out to be an ace of clubs, we have only 2 possibilities. The ace of ace will be either the penultimate or the last card. Thus, the probability increases from 5 to 50 percent.
If the next card does not turn out to be an ace, then the probability that it will be the last card is 100 percent. The probability increases every time when you remove the next card from the deck. Thus, the percentage of probability depends on the number of cards extracted from the deck.
Dependence is formed because each card, which turned out to be not an ace of clubs, influenced the number of remaining options. That's why in a casino card counting is considered illegal. It’s legal to play on the law of probability to get your money, but your attempts to use the law of probability in your interests are considered illegal. If a card that has already been withdrawn is again included in the deck and the deck is shuffled, then the probability of getting the right card will always remain at the 5 percent level.
So what about markets and trading systems for financial markets, do previous results affect subsequent ones?
In the markets, as well as in cards, there may be a relationship between transactions, where the results of transactions affect each other. For example, the fact that the system suffered a loss in long trading can change future winnings. A good analogy for this situation would be most card games. After the card is played and does not return to the table, it will affect the possibility of drawing other cards. However, which card will be played next is a random occurrence. In this sense, the alignment of cards is both an accident and a dependence on past events. This type of situation may be applicable to trading in which past events affect the future.
Why is this happening? My opinion is as follows. As you know, systems are divided into several types. Two of them are well-known trend and channel systems. We also know that the market is dynamic, it is constantly changing - it is moving from the phase of the trend to calmer phases. And in each of these phases, any system will show different results - during trends, trending TSs will have excellent results, during a flat channel strategies will perform better. Thus, the type of system itself and the current nature of the market are interconnected and this connection dynamically affects the results of the system. And this means that there really is a relationship between past and future results of the system.
That is why we just need to investigate this issue and understand how to determine which deal to expect specifically this time - profitable or unprofitable. What is this for us?
In a nutshell, for example, there are trading systems that always strive to have in a row, for example, two losses and two wins. If such a trading system is known, then it is possible to establish a money management approach that allows smaller positions after losing and larger ones after winning. The results of this approach can minimize losses and, indeed, even turn a loss-making system into a profitable one.
What is a z-score
Traders will be able to find a system in which profits and losses alternate. In other words, traders may also find that after winning there will be losses and vice versa. It is also possible to identify the relationship between the profitability of transactions. For example, traders may conclude that highly profitable trades follow trades with low profits, or that profits alternate with losses. Often traders simply "feel" these patterns, but are not able to calculate these dependencies. It is to identify these patterns that traders resort to the methodology for determining the value of Z.
Z-score is a statistic that helps traders analyze the relationship between trades. The Z-score is calculated by comparing the number of groups consisting of the following consecutive wins or losses in the entire set of transactions, with the number of similar groups expected by statistics (if the transactions are independent). Then this numerical value is transformed into another value, which is called the Confidence Interval. The confidence interval is expressed as a percentage.
In fact, the Confidence Interval is the sum of examples that are statistically expected within the standard deviations of X. For example, one standard deviation represents an area in which 68% of all events fail. If the Z-score was one, then the Confidence Interval would be 68%. I will not now explain in detail these statistics, we examined them in detail in the ExcelTrader course.
Let's immediately begin to interpret the values of the resulting z-score. So:
A negative Z-score indicates fewer interlaces in the benchmark transactions than statistically expected. That is, profitable trades tend to follow profitable ones, and unprofitable ones to unprofitable ones.
A positive Z-score means more alternations in the trading system than expected, that is, winning trades tend to follow losing ones and vice versa.
To calculate the Z-score and Confidence Intervals, you must have at least 30 trades in the standard. This is due to calculations that are based on the standard deviation of the system. But in reality, to have more accurate estimates, you need a much larger number of transactions - from a couple of hundred and above. In fact, the more data there is, the more accurate the final result will be. The calculation of the value of Z occurs according to the formula:The value Z = (A * (C - 0.5) - B) / ((B * (B - C)) / (C -1)) ^ (1/2), where: A = the number of analyzed transactions;
B = 2 * number of profitable trades * number of losing trades;
C = the number of alternations in the sample (each pair of deals is considered as alternation when a profitable trade replaces a losing trade or vice versa).
In Excel, such a calculation is performed in just a few minutes. But let's look at one simple example on the fingers. Suppose we have some series of deals:+4; -2; -3; +6; +2; 0; -4; +2; -5; -4.
We are not interested in the size of the maximum or average transaction. We also close our eyes to the fact that there are too few deals - we need to understand the principle of calculation itself. So, we have 10 deals.A transaction with a result of zero is considered unprofitable, therefore we have 6 unprofitable and 4 profitable transactions.
Now let's count the series, it's simple: a series is every change in a character that occurs when reading a sequence from left to right (i.e. chronologically).
We can present our result in the form of pros and cons for the convenience of calculation:+ - - + + - - + - -
Therefore, we have 5 series (five sign changes to the opposite).
Now calculate B
B = 2 * number of profitable trades * number of losing trades = 2 * 6 * 4 = 48 Then A * (C - 0.5) - B = 10 * (5-0.5) - 48 = 45 - 48 = -3.
The expression (B * (B - C)) / (C -1) = (48 * (48-5)) / (5-1) = 2064/4 = 516. And to the power of ½ this will be 22.72.
Then -3 / 22.72 = -0.13
So, our z-score = -0.13.
Now convert your Z account to a trust border. The distribution of periods is a binomial distribution. However, when 30 or more trades are considered, we can use the normal distribution as close to binomial. Thus, if you use 30 or more trades, you can simply convert your account Z into a confidence border, based on the equation for the normal distribution. I won’t explain how to do this either (I can see the ExcelTrader course here).
What level of confidence border is acceptable? Statisticians generally recommend a confidence limit of at least 90%. Some recommend a confidence limit of over 99% to be sure that the dependency exists, others recommend a less stringent minimum of 95.45% (2 standard deviations).
Below you see a ready-made table according to which you can approximately evaluate your border based on the resulting z-score value:
Since in our case we are at the level of a low confidence border, we can say that there is no dependence between transactions in this sequence.
Let's see a closer to reality option:
Here we have a z-score slightly higher than -2, which means there is a positive relationship. In other words, after each profitable transaction, we are more likely to receive a profitable one, and after each unprofitable transaction, we will be unprofitable.
In fact, quite rarely the system demonstrates a confidence border of over 95.45%, most often it is less than 90%, so we can say we were lucky. Even if you find a system with a confidence border of 90 to 95.45, it will not be a gold nugget. To make sure of the dependence on which you can make good money, you need, as a minimum, 95.45%, as in our example.
As long as the addiction is at an acceptable confidence boundary, you can change the system to improve trading decisions, even if you do not understand the root cause of the addiction. If you find out the reason, you will be able to assess when the addiction acted, and when not, and when you can expect a change in the degree of addiction.
A serial test for addiction automatically takes into account the percentage of wins and losses. However, the serial test on periods of wins and losses takes into account the sequence of wins and losses, but not their size. In order to obtain true independence, not only the sequence of winnings and losses must be independent, but also the size of the winnings and losses in the sequence must also be independent.
Winnings and losses may be independent, but their size may depend on the results of the previous transaction (or vice versa). A possible solution is to conduct a serial test with winning trades only. In this case, the winning bands should be divided into long (compared with the average value of the probability distribution) and less long. Only then it is necessary to look for the relationship between the size of winning trades, after which it is necessary to carry out the same procedure with losing trades.
Unfortunately, no significant dependencies between less profitable and more profitable deals were found in the system I modeled. The same goes for losses.
Matching winnings and losses when trading
This money management strategy can be quite effective. However, it works well only with some systems. Many people test this approach and get very good results, but in reality their systems break down. To effectively apply this technique, it is important to know for sure the Z-score of the trading system.
The main strength of this technique is that it allows traders to maximize the risk reward coefficient in situations with high probability, while at the same time reducing risk in situations with low probability. This can lead to the fact that the trading account will grow significantly faster without increasing risk.
Above, we simulated a trading system that gave us a negative z-score with a satisfactory confidence border. Our z-account turned out to be -2, which means that after a losing trade we are more likely to expect another losing trade, and after a profitable trade - another profitable trade.
So, let's start in order. This is what our system looks like with a profit to loss ratio of 1 to 1:
With an increase in the coefficient, the profit to risk to 3 to 1 got a more beautiful picture:
Now, instead of a fixed lot, we will enter into transactions, risking 5% of the deposit in each of them:
The drawdown was 4.6%, profit of about 103%. Now, based on the knowledge about our z-account, we, for a start, will increase the position size by 1.5 times every time we win:
The end result is already much more interesting, isn't it? The drawdown is already 15.4%, but the profit is 1169%. We applied the strategy of increasing the lot of the next transaction every time a position is closed in profit, thereby using the knowledge about the z-account voiced above. Our z-account is negative, which means that after a profitable transaction, there will most likely be another profitable one, and after a loss-making one more unprofitable one.
For profitable trades, it is quite obvious to increase the lot each time. So, after each profitable transaction, we began to increase the lot by 1.5 times. After a losing trade, this logic should reduce the lot. Let's reduce the lot by 1.5 times every time after we get a loss and see what happens from this:
Yes, there is not much profit - 462%, but the drawdown has fallen to 9.9%.
So, as we have seen, increasing the lot after profitable trades for a system with a negative z-account less than -2 allows you to significantly increase the final result. Another method of maximizing profits in this case would be to use the intersection of the balance curves and the moving average of the balance of the trading account to get a guarantee that the system will be in the market during a good phase and exit the market when bad times come. This technique is an approach designed specifically to capture the waves of gain and loss in the system, for which systems with a negative Z-score are ideal.
But all this concerns the initially profitable system. But what if we take a system in which the number of profitable transactions is also 50%, but it will be unprofitable? Remember the system that we took at the beginning of the article? This is the same system that we considered in the previous example, only the profit-to-loss ratio there was 1 to 1:
Here we lost 3% and the drawdown was 20.5%. The system is slowly draining. Now we add multiplication factors of 1.5 and the system stops merging:
Although I would not begin to trade such a system, but still it really stopped merging and even made a profit of 6%.
That is - if you have a profitable system with a negative z-account, you can significantly increase its profitability without increasing the drawdown too much. If the system merges, this approach can bring it to at least zero.
But our study would not be complete if we did not consider a system with a positive z-score, that is, with a situation where after a profitable trade there is a loss-making one, and after a loss-making one, a profitable one.
And here is our model system:
The Z-score here is 2.09. For 300 transactions, the system managed to get a drawdown of 20% and the total loss amounted to 9%. It would be logical to assume that since we most often have a profitable trade followed by a losing trade, it is worth increasing the lot when losing:
This type of trading is known as martingale. Usually it consists in varying lottery according to the results of the last transaction. For example, traders may decide to double their position after a losing trade, hoping to make up for losses, or only after a winning trade to maximize the potential of the system.
Here, of course, not the most thought out option is applied - just the lot is increased by 2 times with each loss. On the first win, the lot becomes basic again. But the point here is that applying the martingale strategy makes sense only if your z-score is higher than 2. See for yourself (z-score is about zero):
Or here is the z-score is negative:
Positive z-score, but not enough:
And finally, another system with a suitable positive z-score:
Please note that we use the doubling of the lot immediately after the first losing trade. You can, for example, apply the martingale mode after two or three losses in a row, which will significantly reduce drawdowns and increase the reliability of such systems. In addition, it is worth thinking in more detail about the martingale system itself. For example, continue to increase the lot until the system recaptures all previous losses.
Decisive traders, having at their disposal a positive Z-account for their systems, can turn this fact into cash if they deliberately apply their own approaches to money management. As we have seen, even a losing system with a positive z-score of more than 2 can be made profitable. Nevertheless, you should be very careful with such a dangerous method of money management as martingale. It can make a profitable system profitable, as we have seen, but it can also easily drain a profitable system. Therefore, to determine whether the system is suitable for the use of martingale, it is simply necessary to use a z-score. In addition, when calculating the z-score, it is worth taking the largest possible sample, since the price of the error can be very high.
Finding out the Z-account of a trading system is one of the best steps you can take. This will make it possible to extract additional profit from the system without changing any of the parameters after the trading signal about entering the market. It is also one of the most direct ways in which traders can turn knowledge into money.
Trading approaches to increasing the lottery in a series of profitable transactions in systems with a negative value of Z show very good results in combination with the method of using moving averages of capital. The interaction of these methods allows you to use the huge potential of a series of profitable trades. The tactics of reducing the volume of open positions with a negative value of Z can significantly reduce the risks of your trading method.
Now you also know what systems you need to look for to apply such dangerous techniques as martingale in order to maximally (as much as possible) protect yourself from losing a deposit. All this will give you the opportunity to increase the profitability of your trade and significantly reduce risks using simple mathematical calculations. At the same time, your trading system itself will not be subject to any changes. This is the most effective way to turn your theoretical knowledge about money management into real money.
In conclusion, I want to remind you that many successful traders claim that it is money management that is the “holy grail” in the forex market and that it is the use of the rules and techniques of money management and risk control that distinguishes successful traders from the losing mass.