Playing a Long-Term Game $\quad$ Part I

Over the past few months, I presented an equation for a scheduled rebalancing portfolio. The equation might appear elaborate but when you break it down, it is really simple. Nonetheless, here it is again, broken into parts:

$F(t) = F_0 +\$X \quad \quad \quad \quad \; \; $ (Portfolio Objective: maximize $\$X$)

$\quad \;\;\;= F_0 + \Sigma (\mathbf{H} ∙ \Delta \mathbf{P} ) \quad \quad $ (The Payoff Matrix: Need to Control $\mathbf{H}$)

$\quad \;\;\;= F_0 + n ∙ x_{avg}\quad \quad \quad $ (Average Net Proft Per Trade Perspective: the edge)

$\quad \;\;\;= F_0 + y ∙ rb ∙ j ∙ E[tr] ∙ u(t) ∙ E[PT] \quad \quad $ (Portfolio Rebalancing)

$\quad \;\;\;= F_0 ∙ (1 + r_m +\alpha _t - \Sigma exp_t)^t \quad \quad \quad \quad \quad $ (Equivalent CAGR Scenario)

All the above equations give the same value for a chosen stock portfolio.

Whatever you do investing or trading in the stock market, your objective is to maximize your profit ($max \; \$X$). You can know the total profit of your portfolio now, but not how much it will be going forward. However, you do know that you want a lot of it, and will take whatever you can get.

You accept that the payoff matrix $\Sigma (\mathbf{H} ∙ \Delta \mathbf{P} )$ is holding the result of all executed trades. And this translates into: $n ∙ x_{avg}$ where the number of trades multiplied by the average net profit per trade is an equivalent to the payoff matrix outcome. You also view the final result of the trading strategy as an equivalent to a compounding return problem. The alpha $\alpha _t$ you bring to the game can be considered an essential contribution. Without it, the long-term trading picture might not be that rosy, since the expectation would be: $E[F(t)] \to F_0 ∙ (1 + E[r_m] - \Sigma exp_t)^t $.

Take a look at the last equation above, the CAGR equivalent to a portfolio's growth. If the portfolio's growth rate is negative: $g_{avg} = r_m +\alpha _t - \Sigma exp_t$, you really have an uphill battle since even your trading skills could not redeem the game. Your alpha would be negative: $ \alpha _t < - r_m + \Sigma exp_t$.

Compounding, especially in trading, is difficult to control. If you are fully invested in stocks, your equity is on the line and will vary up or down daily. Anyone can easily accept the upside. It is the downside that is more troublesome.

It is probably why we do so many portfolio simulations.

However, often, the way we design our trading strategies will simply make them fail over the long term.

We might not know the future, but we can still simulate it using randomly generated price series. Why use random price series? Easy, you do not know what they will do next, except in general terms, just as for the future outcome of your portfolio.


So, let's go into randomness and see the impact of playing for the long term. It should give a better understanding of what is needed to win this game knowing that the expectancy for a randomly generated coin toss series is zero. I will start slow and build up from there.

Let's first generate random stock price series for a no alpha portfolio.

In [1]:
import numpy as np
import matplotlib.pyplot as plt

# initial setup
num_stocks = 10
num_years = 20
num_days = num_years * 252    # 1008 trading days is 4 years
init_cap = 1000000
In [2]:
# initialize needed arrays to zero
assets = np.zeros((num_stocks, num_days))  # 5040 trading days is 20 years
returns = np.zeros((num_stocks, num_days))

# starting with alpha = 0.0, meaning no skills at all, no edge.
# this makes this strategy a martingale.
alpha = 0.0

# Random Return series
R_1 = np.random.normal(1.0 + alpha, 0.03, num_days)
returns[0] = R_1

# Equity line
assets[0] = np.cumprod(R_1)

# Final liquidation value
liq_value = round(assets[0:1][-1][-1]*init_cap,2)

# Plot equity line
fig = plt.figure(figsize=(15, 5))

# Print stuff
print("Trading Days: {:,.0f}".format(num_days), "     Total:", num_years, "years")
print("Initial Capital: $ {:,.0f}".format(init_cap))      
print("Portfolio's Ending Value: $ {:,.0f}".format(liq_value)) 
print("Total Portfolio Gain or Loss: ", round( ( (liq_value - init_cap ) / init_cap )*100,2), "%")
print("Equivalent Ending CAGR: ", round((assets[0:1][-1][-1]**(1/num_years) -1)*100,2),"% compounded per year.")
Trading Days: 5,040      Total: 20 years
Initial Capital: $ 1,000,000
Portfolio's Ending Value: $ 35,162
Total Portfolio Gain or Loss:  -96.48 %
Equivalent Ending CAGR:  -15.41 % compounded per year.

The above equity line chart is from the daily percent return matrix (assets[0]) which was randomly generated with a standard deviation (sigma) of 3%. This puts 99.7% of the generated return data between $\pm$ 9% with most of it tending to its mean of 1.0, the no-return scenario. The cumulative product of returns was used to generate this equity line: $\: return_t = \prod_i^t(1 + r_i)$.

Most of the random series generation was taken from the Numpy Tutorial.

Running the above code many times, you should start to make some simple deductions. One of which is that most often, the equity line ends negative even if the code specifically gave it a zero-profit zero-loss expectancy. The probability of going up or down was 0.50. Here is another representative example:

The above chart is not a good story but still part of the millions that could be generated from the above code. Some scenarios do come out positive. However, in this case, you would have lost 75% of your initial stake playing that game for 20 years, this with no fault of your own and you would have also lost 20 years of your precious time.

The low-performance culprit is simply thinking that the $\pm$ 3% sigma was at equilibrium. The function of interest here is: $\,init\, capital ∙ \prod_i^t(1 + r_i)$ where $r_i$ is the randomly generated 3% sigma return. Even a single trade can show this disequilibrium: $(1+0.03)∙(1-0.03) = 0.9991$. It is not much on a single trade. However, the expected outcome on 5,040 trades with a 50% hit rate is: $ [(1+0.03)∙(1-0.03)]^{2520} = 0.10$. Therefore, the following certainly holds:

$\quad (1+0.03)∙ (1-0.03)∙\cdots∙(1+0.03)∙(1-0.03) \neq 1.0$.

The expectancy, over 5,040 trading days is: $ (1+0.03)^{2540}∙(1-0.03)^{2540} = 0.1035$ which shows that the portfolio's return degradation is self-made, built-in, and maybe the worse part, unavoidable.

Anyone designing such a trading strategy is expected, almost certainly, to lose over the long term, not because the strategy is necessarily evil, but simply because it is mathematically structured to fail.

Who would do something like this? Anyone could, look at strategies where the profit target and stop loss are set at the same level or in some way get there. You would have the same side effects. Regardless, it would still be something that was part of the strategy's design process. My suggestion is: stop designing your trading strategies to fail. It is not that hard.

The above function: $ (1+0.03)^{2540}∙(1-0.03)^{2540}$ is very sensitive to the number of hits. For example, a hit rate of 52% would give: $ (1+0.03)^{2620}∙(1-0.03)^{2420} = 41.80 ∙ init\, capital$. This small edge can have a major impact on your long-term performance level.

Not so much in the short term. Over a 2-year period with no edge you get: $ (1+0.03)^{252}∙(1-0.03)^{252} = 0.80$ Whereas over the same period with a 52% hit rate, we get: $ (1+0.03)^{262}∙(1-0.03)^{242} = 1.45$. Even that slight edge makes the strategy profitable. It is over the long term that without an edge the portfolio's return deteriorates. We need to understand such equations in order to better control our trading strategies and make them more profitable.

$©$ 2020, Guy Fleury