May 24, 2020

My last article (**The Inner Workings Of A Stock Trading Program - Part I**) stated that a single line of code was dictating the long-term behavior of a stock trading strategy. And that this scheduled rebalancing was sufficient to explain the number of trades that would be carried out over the life of this portfolio. In that article, the first part of the presented equation provided this estimate of the number of trades that would be performed over the years.

Other important observations could be directly extracted from the same equation. Having a portfolio's payoff matrix equation to explain an automated trading strategy implied that the outcome did, in fact, answer to mathematical functions. And that it is these mathematical functions that are driving the show.

Here is the equation again:

F(t) = F_{0} + Σ (**H** ∙ Δ**P**) = F_{0} + y ∙ rb ∙ j ∙ **E**[tr] ∙ u(t) ∙ **E**[PT] = F_{0} ∙ (1 + g)^{t}

where *y* is the number of years the rebalancing is applied, *rb* is the number of rebalances per year, *j* is the total number of stocks allowed in the portfolio, and **E**[*tr*] is the expected turnover rate. u(t) is the betting function, E[PT] is the expected average profit margin, and g is the portfolio's equivalent growth rate over the period.

**The Scheduled Rebalancing**

The rebalancing dealt with a portfolio's expected number of trades **E**[n] = y ∙ rb ∙ j ∙ E[tr]. It was sufficient to make long-term trade estimates.

The other section of the equation u(t) ∙ **E**[PT] deals with the profitability of the trading strategy where u(t) was a fixed weighing function proportional to the ongoing equity value. As such, the bet size would be a function of the number of stocks in the portfolio: u(t) = F(t) ÷ j. This made every bet, every trade, a fixed fraction of available equity. As a consequence of this full exposure, the sum of weights for the 400 stocks would equal 1.0: Σ w_{j} = 1.0.

In a 400-stock portfolio, each bet would start with a 0.25% of equity (1/400), no matter how many trades would be executed over the portfolio's lifespan. This forces the strategy to consider that every trade taken started on the same basis throughout. In a way, one bet size, one fixed fraction, fits all. And because of the proportionality, the bet sizing would increase over time at the same rate as the increasing portfolio u(t) = F(t) ÷ j, thereby making bigger and bigger bets as the equity increased.

The initiating bet size would remain proportional at 0.25% of the portfolio's ongoing equity. It fixed another element of the above equation. It is as if it was not your fault that the trading strategy was trading the way it did, but it was your strategy design that was dictating the outcome since most of the choices presented were either by design or by choice.

The strategy was not asked to select 400 stocks as trading candidates, it was told: use the top 400 stocks based on this or that set of criteria, and rebalance every week from start to finish. And because you had selected 400 stocks, the betting system was also fixed. Every trade would get 0.25% of equity, also from start to finish. All you had to do was declare somewhere in the code how many stocks you wanted to trade (TOP_N_MOMENTUM_TO_BUY = 400).

These decisions could be considered more administrative than letting the trading strategy decide those things for you. It was the result of your outside decisions that were setting the system to trade in a particular way over an extended period of time.

**So, Where Is The Money**?

The money to be made will result from the second part of the equation: u(t) ∙ **E**[PT], where **E**[PT] is the expected average percent profit per trade, and u(t) is its growing betting function. From the equation, and due to the full exposure: Σ w_{j} = 1.0, u(t) will grow at the same rate as the portfolio. Should the strategy manage a 10% return, then u(t) will grow at 10% as well since it is proportional to equity: u(t) = F_{0} ∙ (1 + g)^{t} ÷ j.

Due to the periodic rebalancing, the strategy will be playing a statistical game, whether it likes it or not.

The strategy is expected to gain, on average, part of the average weekly variance. Each week, there will be some kind of bell-curved distribution of returns with mean and variance relatively close to the preceding week. Some of the stocks will have gone up, and some will have gone down.

The rebalancing procedure would sell part of the shares held in the stocks that rose and increase the weights of the stocks that went down from the week before.

The funny thing is that if all the stocks would go up or down by the same percentage, there would be no rebalancing, no trades, since all the stocks would have kept there percent of equity fixed (0.25%). Therefore, all trades that will occur on any week will be linked to the deviation from the average. And just as you could not predict in which direction the average price movement would be over each of those weeks, you will not be able to predict their magnitude either, except in statistical terms.

It is when a stock diverges from its 0.25% equity that it triggers a cascading effect in the other stocks. If you had just one stock that went up during the week, it alone would trigger all the other trades in order to rebalance all the stocks to their respective 0.25% of equity. This places a lot of randomness into the execution of those trades. It is not that your program is predicting anything, it is that the stock prices changed for whatever reason, and the program executed its rebalancing without any consideration as to what your “predictions” were. It just happened that the stock price went up, and part of the inventory was sold to rebalance it back to its 0.25% equity.

**The Alpha Decay**

Another aspect of the above equation is that its alpha decay is actually built-in. The estimated average number of trades **E**[n] = y ∙ rb ∙ j ∙ E[tr] remains relatively stable on a yearly basis since the expected turnover rate **E**[tr] will tend to a constant the more trades there are.

The market does not change because you happen to trade on an automated basis. And since your average net profit per trade will tend to an average over the life of the portfolio: u(t) ∙ **E**[PT] = x_{avg}, it will transform the strategy into a linear system. Each year, on average, you should see the profits coming in but represent a lower percentage gain over the previous year simply due to the strategy's inherent design.

The rebalancing is forcing the strategy to gradually break down. It is not only the law of diminishing returns that is at play here but the actual architecture of the program itself, which is forcing this alpha decay. The long-term return will gradually fall as the trading strategy progresses in time. And you explicitly made it happen by how you designed the strategy.

If you do not compensate for this alpha decay (see my articles or books on this subject), then the program's structure will prevail, and the portfolio's return performance will continuously go down with time.

Will your trading strategy break down over time? Definitely, yes. Therefore, you need to compensate in your program to reverse the effect of this alpha decay. Note that the alpha here is the alpha over and above the average long-term market return and not just a source of profit. If your trading strategy cannot outperform the market average benchmark, it is not worth much, since you could have bought a market average proxy (like SPY), and do better than using your strategy, with a lot less effort.

**Related Recent Articles**:

**The Inner Workings Of A Stock Trading Program - Part I**

**Lessons From The Portfolio Rebalancing Gambit**

**The Portfolio Rebalancing Gambit. Part III**

**The Portfolio Rebalancing Gambit. Part II of III**

**The Portfolio Rebalancing Gambit I**

May 24, 2020, © Guy R. Fleury. All rights reserved.