Sept. 03, 2024
In any stock trading strategy, we need an edge to win. We should be able to generate some alpha in excess of the expected long-term average market return. The alpha is not free. It is earned. It means you have to make it happen as a side effect of your trading methods.
We have to trade in an unpredictable future where stock prices will go up and down. Some stocks will even go bankrupt. Yet, you will have to generate that alpha in that uncertain environment. Otherwise, you will underperform or achieve, at most, the market average. Alpha generation is relatively simple to achieve, as Stock Trading Strategy Alpha Generation will demonstrate.
In my last article, There Is Always A Better Retirement Fund - Part II, I referred to the geometric Brownian motion (GBM), which has a drift component overlaid with a normal distribution of randomly distributed price variations.
CLICK HERE FOR THE PDF VERSION
In Stock Trading Strategy Alpha Generation, I will use the GBM for long-term modeling of stock prices and portfolios. I aim to demonstrate that it still has something to teach us, especially long-term-wise. We have other equations to model stock prices to make reasonable representations of price movements and portfolio outcomes (a few are given in the above-cited article).
Usually, when a paper uses the GBM, it is to represent the random nature of a short-term data series. We rarely see anything on their use in long-term stock portfolio management except to show the random-like behavior of price variations. Its basic equation is F(t) = µdt + σdW.
The advantage of using a GBM is that it will not cross the zero line as a series built using a Brownian motion could. Therefore, a GBM price series, which could also be expressed as S(t) = S0 ∙ expµt, can and will survive a simulation, not break down, and will highly depend on the variance exhibited by the price series.
A GBM with no variance is simply an exponential function such as the future value formula: S(t) = S0 ∙ exp(rm_avgt) ≡ S0 ∙ (1 + µavg)t. Transposing this to a portfolio model, we would have F(t) = F0 ∙ (1 + rm_avg)t where µavg ≈ rm_avg since both will have the same slope on a chart.
Like a product function of returns such as F(t) = F0 ∙ ∏t (1 + ri), the GBM cannot, by construction, fall to zero. It can get close, very close, but it will not cross the zero line, which can be a helpful property to have.
Figure 1: SDE Model - Python Code
Chart #1: Basic SDE Model (same as in "martingales.pdf")
We should be able to use a GBM within a stochastic differential equation (SDE): F(t) = µdt + σdW to model stock prices or portfolio values since it does provide a means to identify a drift component and a random walk (Wiener process). The Python code (Figure #1) came from "martingales.pdf", published on LinkedIn, and was used to produce Chart #1.
We can use the future value formula to express the average market return FV = PV ∙ (1 + rm_avg)t. The market's average return rm_avg = 6.9% has held for 200+ years. See Figure #1 in the above-cited article.
Will it hold for another 20 to 50 more years? Or, should we view rm_avgonly as an approximation of what was and consider it might be different going forward? Instead of dealing with rm_avg, should we not project some probable range with some leeway, such as E[rm_avg] ± Δ%?
Chart #1 above looks realistic enough, as if it is a real stock price data series. We could easily accept it as a genuine price series if we did not know its origin.
Chart #2: Basic SDE Model (252 steps)
Nonetheless, it is unpredictable at every step, except for its drift component. Note that based on Chart #1 above, you would not be able to figure out there was an upward drift, not even after more than 800 steps out of 1000. Changing the seed or commenting it out would give a new and different data series.
The data series would remain unpredictable. Except for the drift component, which, on average, would trend upward since µdt is given as positive. But not always. At times, you would still see what seems like a downward-sloping trend even if the equation's theoretical drift was pointing upward.
You could not predict the wiggles, but you might reach the most expected value based on the function's drift: E[µ]dt, or relatively close to it most of the time.
Chart #2 above shows the first 252 steps of Chart #1 with no alpha. Changing the seed would give a different chart. Note that the drift, even if there is one, would also be difficult to extract from that chart. Chart #2 would not give anyone any great motivation to either invest in or trade it, even over the short term, since none of its price movements would be predictable and could change direction at every step or the flip of a coin.
Modifying The Context
The initial scenario was designed to mimic a stock price over a year with 1000 data points (refer to the code in Figure #1). It can be a reasonable representation of a random walk with drift. However, the example was chosen. You would see a different picture if you ran that program with a different seed or with no seed. Not all the stock price series would be pointing up. Even a random walk with a built-in upward drift can trend downward.
I aim to enhance the above-cited program to give the GBM a long-term perspective of a stock price series or a portfolio, exploring the model over extended periods.
Wanted Modifications:
- Code to make the number of steps equal to the number of trading days
- Increase the amplitude of price variations by a factor of 1.5x
- Add two sources of alpha to the equation (α1, α2)
- Add a leveraging factor to increase the impact of price changes (not used)
- Print summary results and charts
Over the long term, the charts do illustrate that we are dealing with an exponential function which could also be expressed as F(t) = F0 ∙ exp(rm_avg + α1 + α2)t and not just plain: F(t) = F0 ∙ expµt.
These SDE models have all been designed with a backdrop of the efficient market hypothesis (EMH), where alpha is non-inexistent in a scenario with no arbitrage available. Even the Capital Asset Pricing Model had no place for alpha. It needs to be added in.
Notwithstanding, we are advised early that either in trading or investing, we should find a long-term edge. One edge that is easy to get is the one already built into the system: the long-term upward drift shown in average stock prices over the last 200+ years. The same drift you could find in an SDE equation.
Therefore, your portfolio's expected long-term growth should rely on F(t) = F0 ∙ (1 + E[rm_avg])t, meaning that at least it should get close to the long-term market average. Buying SPY and holding over the long term could readily achieve that goal.
Chart #3: SDE Model - 10 Years - Alpha = 0.0
However, to explain a portfolio's outperformance, you need more than just tending toward the market average; you need to exceed the long-term average return. And that is where your alpha comes in:
F(t) = F0 ∙ (1 + E[rm_avg] + α1 + α2 + ∙∙∙)t
You will need some alpha to outperform the market average, no matter its origin. Without it, you are just making average, like an indexed fund or a market proxy such as SPY.
The code in Figure #1 can be modified to extend the long-term impact of the SDE. You are not playing for only a few years but for a few decades; therefore, your SDE should be able to model that with minor changes.
First, let's show the outcome for a single year to compare the price series from Chart #1 over the short term. In Chart #3, the first 252 steps are the same as in Chart #1 and Chart #2. The point is to show that the charts will depict their random-like price series over the short term. It is by extending the time interval that things will change.
For instance, jumping to 10 years using the base configuration (Figure #1), we get Chart #3 above.
As should be expected, changing the seed would generate different charts. Note that the first 252 steps are identical in the above three charts. Chart #2 is a blowup of the first 252 trading days of Chart #3. The initial wiggling is already starting to look like a simple dip in price and of little consequence considering the outcome. Again, changing the seed would give a different price series.
Chart #4: SDE Model - 10 Years - Alpha = 0.20
(Click here to enlarge)
Enhancements
The purpose of adding enhancements is to increase the overall long-term return.
To do so, we follow the equation: F(t) = F0 ∙ (1 + rm_avg+ α1 + α2 + ∙∙∙)t where we add alpha sources which could take many forms. The objective is to raise a would-be trading or holding strategy's long-term performance level, benefitting the whole portfolio over the long term.
We did not add much to the trading strategy, yet the performance level was considerably enhanced. Again, the first 252 steps are almost identical to those in Charts #1, #2, and #3. Now, on Chart #4 above, that sequence of price movement has been flattened out due to the increase of the ending value. In Chart #3, you had a 17.35% CAGR. In Chart #4, the CAGR jumped to 43.70% just by adding some alpha (0.2) to a randomly generated price series.
Some effort should go into finding and applying those alpha sources to a trading or holding strategy. Those equations all have total market exposure as a premise.
Increasing the alpha to 0.4 generated Chart #5.
Chart #5: SDE Model - 10 Years - Alpha = 0.40
I have not changed the nature of the random price variation generator; it still behaves the same as in all the previous charts. As you add time to the equation, we can see even better that the initial 252 steps have been technically flat-lined. It, again, makes the point that it is the endgame that matters the most. You need to be in the game until the end to get the most out of it.
Increasing the time interval to 20 years produced Chart #6.
Chart #6: SDE Model - 20 Years - Alpha = 0.40
Changing the program seed will have an impact since no matter what the seed is, the outcome will be different. You do not know and cannot know what the stock's general path will be. As can be seen in Chart #7 below, changing the seed could even enhance the outcome.
Based on another seed, the program would produce something higher or lower. There is no way of finding out before the simulation. However, should you make enough simulations, you could find the average performance level and, from there, get an expected long-term expectation of the outcome.
You could produce millions of charts like Chart #7 and still be unable to predict its long-term CAGR. I refer you again to the above-cited article where, for example, the strategy's alpha was at 0.40 over 14.4 years with impressive results even though it played heads at every flip of a coin every Monday to gain a position for the week.
Chart #7: SDE Model - 20 Years - Alpha = 0.40
Going for 30 years under the same conditions that generated Chart #7, we might have something like Chart #8 below.
Chart #8 should emphasize that the alpha generation is critical.
Chart #8: SDE Model - 30 Years - Alpha = 0.40
Taking the alpha out of the picture and under the same conditions that generated Chart #8, we might get something like Chart #9 below.
It points to the critical role that the alpha plays in your game. Without it, your long-term outcome might be just ordinary, with nothing to brag about.
This exercise also shows that a GBM can help model long-term portfolio scenarios. It also stresses where the emphasis should be put to increase the overall performance.
Whatever you design as the potential alpha source, it should also prevail for the duration of these simulations. The alphas were made constants when, in real life, these alphas would also follow a random walk. It is why you tend to average things out; these long-term averages will matter in the end.
Chart #9: SDE Model - 30 Years - Alpha = 0.0
Starting with S0 = $100,000 would add three zeros to the portfolio's outcome. See Chart #10 below, which uses the same parameters as Chart #8 but with a $100k starting capital.
As should have been expected, you get the same CAGR but with three zeros added to the total outcome.
Not using an initial seed value would generate different results each time one would be requested.
We could do thousands of simulations with the seed having no initial value, and all the results would differ. Still, you could average them out to get an expected value.
Chart #10: SDE Model - 30 Years - Alpha = 0.40 - $100k
Chart #11 below gives another iteration of Chart #10 but uses no seed to show that the portfolio paths would be different. Each rerun of the program would give a different outcome.
Chart #11: SDE Model - 30 Years - Alpha = 0.40 - $100k
Where is the beef?
All that preamble to get to: "Where is the beef?"
All the charts were generated using the code in Figure #1 with little modifications. These include: changing the steps to trading days, increasing the amplitude of the random price variations by 1.5x, adding some alpha (0.2 and 0.4) in the random-like generating equation, and going with and without a seed for the random function. All of these were used to create different scenarios over different time intervals.
The objective was to see how it would all behave without knowing the immediate outcome of the random-like price gyrations.
We have in Chart #1 what the original program did. The generated chart looks like a genuine price series, resulting in a random normal distribution over an upward drift.
Up to Chart #6, the first 252 steps are about the same since having been generated using a seed for the random normal distribution.
What we should observe is the different representation of the first 252 steps (days) of those charts. For instance, on Chart #6, those initial steps appear flat-lined. Indicating that maybe we should not have worried so much about all the price gyrations going on. The most crucial point would have been to participate over the long term and find those alpha sources to propel the result of that equation higher.
As an example, refer to the TQQQ strategy One Percent Per Week. Part VIII. The last simulation had the numbers below taken from Welcome To YOUR Stupendous Retirement Fund, Figure #2.
The average profit per trade was 1.03%, holding on to its attempt to make One Percent Per Week. It managed to do it over 753 weeks (14.4 years). It took a position every Monday, like playing head at every coin toss. And in doing so, it should get close to the underlying up-and-down market average. In this case, it was 51.26% winners, close to the upside bias we find in weekly stock price variations. Also, the alpha for that strategy was 0.4, the same as used in some of the above simulations. The long-term historical sigma is about 0.16, the same number used in the simulations.
The average loss percent per losing trade was -2.65%. No code tried to reduce or bypass those losing trades. Therefore, we should have expected that on the winning side, we should have had a 2.65% average gain per trade or close to it. That is, if the trading environment, with its ups and downs, were close to normally distributed. The average gain per winning trade turned out to be higher.
The winning side had an average profit per trade of 4.53%. And that was sufficient to generate the bulk of the profits. So, the question should be: where and why did we get that 4.53% average profit per winning trade?
The solution to that problem is easy: you create an imbalance between +aσ and |-bσ| such that +aσ > |-bσ|. As already stated, we had an average profit per trade of 4.53% compared to the average loss of -2.65% per losing trade. It was achieved by requesting an exit on the positive side of the distribution and none on the downside. The 7% profit target was raising the average positive exit just as the conditional bump to 8% exit did.
You simply took some profits off the table while you had them and won.
Each of those trades above the 2.65% threshold gradually increased the overall performance level one trade at a time. All you have to do is continue to trade in that fashion, and over the long run, you win.
Another crucial point to emphasize is the long-term focus of the strategy. The SDE charts underscore that the concern should not be for the short term but for the long term, where the real difference is made. Reaching that endgame will require market participation and perseverance. Even if the price variations were randomly generated, being fully invested and having a long-term view of the game would be a requirement.
The Caveat
The whole picture would change if you did not provide any alpha. For example, making alpha zero in that program, removing the price variation amplifier (1.5x reduced to 1.0), and increasing the volatility to 0.20 would make the 30 years spent on building your fund plain ordinary, as Chart #12 below can attest.
All it provided was a 6.98% CAGR. Coincidentally, it is near the 6.9% CAGR given as the 200+ year market average. See There Is Always A Better Retirement Fund - Part II, Figure #1. Running another simulation would give different numbers, as should be expected since no seed was used. It remains a stochastically driven price series based on a positive growth rate F(t) = µdt + σdW.
Chart #12: SDE Model - 30 Years - Alpha = 0.0 - Volatility = 0.2 - $100k
Should you increase the volatility to 0.4, the picture would change again. From what remained a favorable scenario, as in Chart #12, you get a negative 30-year return with a CAGR of -7.27% (Chart #13). That is not a great way to build a retirement fund. The worst part is that it took you 30 years to get there, and you would have nothing to show for all your efforts.
Increasing the volatility to 0.6, your CAGR would drop further to -11.34%, reducing a $100k initial portfolio to $2,700 after 30 years of work (see Chart #14).
Chart #13: SDE Model - 30 Years - Alpha = 0.0 - Volatility = 0.4 - $100k
Chart #14: SDE Model - 30 Years - Alpha = 0.0 - Volatility = 0.6 - $100k
(Click here to enlarge)
The simple fact is that you will be close to a normal distribution near the mean of any stochastically generated price series. And with a mean of zero, you will have a ±var% on either side of the mean. It raises the fixed-fraction problem, an assured long-term return degradation, which should also be part of the Law of diminishing returns.
Fold a normal-like distribution such as σdW at its zero mean. Being a normal distribution, you should get + var% ≈ |- var%| and that is sufficient in the product function F(t) = F0 ∙ ∏t(1 + ri) to tear it apart since (1 + var%) ∙ (1 - var%) < 1.0.
The normal distribution in trading is destroying your long-term portfolio.
For example, since the product equation above might have a 20% rise followed by a -20% drop, we would get (1 + 0.20) ∙ (1 - 0.20) = 0.96, which might appear trivial since we have all seen a portfolio drop of 4% before.
We can make that statement since we are taking data points on a zero-mean normal distribution, where we would also have a negative counterpart for every positive var%. The half below the mean is a mirror image of the half above the mean. It also means that every point above the mean has its counterpart below.
We could generalize more and say that, within the product equation, the ± var% could be randomly distributed. These price variations do not have to be side by side. All that is requested is that within the chain product of returns, they appear somewhere to give the above result (1 + 0.20) ∙∙∙ (1 - 0.20) = 0.96. But there is more.
Your trading strategy could make hundreds of trades, and the above product equation would still hold. Therefore, we could also say: [(1 + 0.20) ∙ (1 - 0.20)]50 = 0.12988. And that is not good news for your portfolio. You would be left with 12.988% of your original $100k investment. It would only get worse if you had more trades [(1 + 0.20) ∙ (1 - 0.20)]100 = 0.01687.
Maybe we should look for another representation or, better yet, make the distribution asymmetric in our favor. For example: [(1 + 0.20) ∙ (1 - 0.10)]50 = 46.90 and [(1 + 0.20) ∙ (1 - 0.10)]100 = 2199.76.
That is the general idea that was used in There Is Always A Better Retirement Fund - Part II and in the One Percent Per Week series of articles to reach those outstanding results.
You create the return imbalance in the above product equation, and you will stop worrying about all the price gyrations coming your way. Thereby exploiting the very nature of σdW, which, no matter what you do, has a mean of zero: Ʃt σdWt → 0.
All this is to make the point that if you do not provide any alpha and the average volatility increases, you are doomed.
The fully invested trading or investing strategy will be subject to long-term return degradation, as was often described in my articles and papers. Your trading methods have to compensate for this built-in return degradation.
So, you are facing a dilemma. You invest for the long term and get the long-term market average of about 6.9%, or you go short-term trading, where you are doomed without the long-term alpha generation, no matter how it is created.
Since we have equations to model a stock portfolio's outcome, whatever happens in our trading procedures will end up satisfying those equations. An SDE without alpha might go nowhere performance-wise.
You are the one to accept and execute your trading or investing program. If it is not based on sound principles, where you should know the origin of your alpha and know if it will also be there in the future. You might find yourself with a strategy falling in the range of Figures #12, #13, or #14. When you should strive for Figures #5, #6, #7, or #8.
It is up to you to choose which future you want, even if a lot of it will be based on quasi-random price series.
Related Papers and Articles:
There Is Always A Better Retirement Fund - Part II
There Is Always A Better Retirement Fund
Welcome To YOUR Stupendous Retirement Fund
The One Percent a Week Stock Trading Program - Part VIII
The One Percent a Week Stock Trading Program - Part VII
The One Percent a Week Stock Trading Program - Part VI
The One Percent a Week Stock Trading Program - Part V
The One Percent a Week Stock Trading Program - Part IV
The One Percent a Week Stock Trading Program - Part III
The One Percent a Week Stock Trading Program - Part II
The One Percent a Week Stock Trading Program - Part I
The Long-Term Stock Trading Problem - Part II
The Long-Term Stock Trading Problem - Part I
The MoonPhaser Stock Trading Program
Anticipating A Stock Portfolio's Long-Term Outcome
Sitting On Your Bunnies Might Be Your Best Investment Yet
Make Yourself A Glorious Retirement Fund
The Age Of The Individual Investor
Use QQQ - Make the Money and Keep IT
Take the Money and Keep It – II
Created: September 3, 2024, © Guy R. Fleury. All rights reserved.