August 2, 2018

Following my last article: The Math of the Stock Trading Game is Quite Simple, I thought it might be of interest to provide an example with numbers while keeping with the portfolio's payoff matrix equation as presented. You look at a problem long enough and you start to synthesize what it is all about. Not that you master it, but that you can somehow replicate its parts.

The idea here is to show the impact trading mechanics can have on the outcome of a trading strategy. The numbers do not belong to a particular trading strategy. The numbers are, however, representative of some strategies I have seen lately on Quantopian. We could view these numbers as a variation on the same theme.

Nonetheless, they should make the point. Which is: demonstrate that slight changes in the behavior of a trading strategy can have quite an impact when the number of trades is large and executed over extended periods of time.

Trading is a Journey

No one should trade for a week, stop, and then wait for years. It is not productive enough to sustain any long-term objective, except if you were very very lucky.

The following table shows a strategy generating some 200,000 trades over an undetermined time interval. What we are interested in is the portfolio's payoff equation as presented in the above-cited article, wherein all the variables are described in detail. The equation is reproduced here for convenience's sake:

F(t) = F(0)∙(1+g_bar)^t = F(0) + Σ(H∙ΔP) - Σ(Exp) = F(0) + n∙x_bar = F(0) + (n - λ)∙AW + λ∙AL

  Figure 1: Outcome of Payoff Matrix Equation
  Outcome of Payoff Matrix Equation

(click to enlarge) 

From the chart, the initial stake is set at $10 million with 200,000 executed trades. The number of trades (n) is sufficiently large to make it statistically significant and allow us to speak in terms of averages.

Where is the Money

In the first panel, the average win (AW) equals the average loss (|AL|). We have: AW = |AL| = $100. With a 50% hit rate, the strategy's outcome is zero, no reward. It would have made 200,000 trades with not even a penny to show for all the work.

This is equivalent to having an x_bar of zero, no edge, therefore no profit. It is the same as the expected outcome of tossing a fair coin. An x_bar of zero does translate to no gain, but also to no loss. You lose if x_bar goes negative. Those scenarios do exist but are not considered in the above table.

Designing trading strategies with a negative x_bar is not desirable since, on average, you would be paying to lose money to play the game. Evidently, do not do that. Know your strategy's numbers before you trade live, and a simulation can easily give you an estimate of those numbers before even considering such a decision.

An Edge

A 51% hit rate, or a 1% edge, is sufficient to make some money, even in a scenario where AW = |AL|, as illustrated in panel 1. Tossing a loaded coin having a 1% bias would give the same expected outcome. It gets better as the edge increases.

The middle panel shows the strategy after improving AW, its average win per trade. Not by much. At the 50% hit rate, it is $50 per trade. It could be done simply by requesting, on average, a higher profit target per trade.

The Win/Loss Ratio

In panel 2, even with a 50% hit rate, you win. Even more so than the best in the first panel at a 60% hit rate. The effort to increase the average net profit on the average winning trade was worth it. Going to the 51% ratio does increase performance, but not by that much. It is the hit rate which is improving x_bar and thereby the total outcome.

At a 60% hit rate, panel 2 generates 4 times as much as in panel 1. Yet, AW is just twice |AL| which was set at -$100. The 50% hit rate did $10 million while at the 60% level the total moved up to $16 million in profits. All simple numbers to compute. It also stresses the importance of a better hit rate which has for expression: (n – λ)/n.

Panel 3 shows the impact of doubling AW and |AL|. Evidently, it doubles the outcome whatever the hit rate. But note that, at the 50% hit rate, we have only added $50 to x_bar compared to panel 2. This is not a huge amount when your trading unit is at something like $25k or $50k (a 400 or 200 stock portfolio). Making $100 on a $25k bet is 0.40%. So, I cannot consider this a big move. It is equivalent to a 40¢ move on a $100 stock, 20¢ on a $50 stock and 10¢ on a $25 stock. That kind of price move is available thousands of times a day.

When designing our trading strategies, we definitely could benefit from improving the spread between AW and |AL| as well as improving on our hit rate since these numbers do have an impact on x_bar as shown in Figure 1.

The Value of Time

Figure 1 does not consider time in its calculations since it is all concentrated on execution and the account's bottom line which is the outcome of the portfolio payoff matrix equation. Figure 2 tries to partly remedy the situation: 

  Figure 2: The Value of Time
  Value of Time

(click to enlarge) 

Figure 2 makes the compounded annual growth rate (CAGR) calculations for a 3, 5, 10, and 20-year time interval. The first section of the chart is the same as in Figure 1. The CAGR formula is simple: [(F(0) + n∙x_bar) / F(0)]^(1/t) – 1.

We can observe that the longer the time period to execute the 200,000 trades, the lower the CAGR is. Even at its best, in panel 3 with a 60% hit rate, the 20-year CAGR is just 7.44%. Yet, it looked impressive if one did not do the calculations. A $32 million profit on a $10 million investment is still money. Depending on the time interval it was executed, it could have been an impressive CAGR.

The Need to Rush

What Figure 2 shows is that there should be a rush to execute those 200,000 trades, making it as fast as possible. That is how you can improve your CAGR. Increase your hit rate on your positive edge. It does not say how you do it, only that it needs to be done, or is the result of the modifications you bring to your trading procedures. In a way, it is up to you to design the strategy you want. But, if what you do does not impact the numbers in the portfolio equation, then do not be surprised if the overall outcome does not change.

This leaves the door open to any type of trading strategy, whatever the basis of its edge. You want results, they can be had by designing strategies that will respect the portfolio equation. You want to ignore it, it's OK. The equation will still tally the result anyway and keep the score in your trading account. Except that, it will do what it has to do and not necessarily what you want it to do.

Have a Trading Plan

Plan for what you want to see, then program your trading strategy to do the job you want. You can design a table like the one above for your own portfolio scenarios. Your simulations can provide the numbers.

At the end of the game, the portfolio's payoff equation will prevail. It is not an opinion, not even a bold statement. It has been carved in stone for quite some time.

Improving on Your Strategy

If you want to improve your trading strategy, meaning have it do more for you. Then the solution is simple. Find ways to increase the number of trades having a positive impact. Increase the average profit per trade (AW). Reduce the number of losing trades λ. Increase the spread between AW and |AL|, the more you do so, the more your hit rate (n – λ)/n will scale up your profits.

These suggestions are going for the mechanics of the trading strategy and not necessarily for better factors or indicators. For instance, increasing AW could be a simple matter of procedure or policy to simply delay gratification thereby exploiting part of the market's general upward tendencies.

The economic reason is also very simple. The variance of stock prices is proportional to the square-root of time. You will find this all over academic papers starting with Bachelier in 1900. In the end, it is all up to you.

You want to win, that's understandable. Then you better understand the math of the game. Or, else... repeat after me: cash o∙b∙l∙i∙v∙i∙o∙n. Or, I used to play that game.


Created... August 2,  2018, © Guy R. Fleury. All rights reserved