April 9, 2017
From what was presented in A Quest for Stock Profits – Part I, one might conclude that there was very little there of interest. Most of it almost ordinary. Nothing to make a fuss about. On the other hand, it might have been an appetizer, part one of a two-part series. There is definitely more to the story.
Chart #3 in Part I is already showing a 28.17% CAGR net of all trading expenses. A more than reasonable return over its 14.42 years. To gain some appreciation for this number, the initial capital would have grown to 35.87 times its original size according to A(0)∙(1 + 0.2817)^14.42 = A(0)∙35.87. Turning $100,000 into $3.5 million. While during the same period chart #1 would have provided: A(0)∙(1 + 0.1146 )^14.42 = A(0)∙4.78 = $ 478,000. Something slightly below market average, but still better than a bank account, but not better than an index fund.
I gradually modified the strategy, added some leverage, moved to a $1 million initial capital scenario (chart #6 below). Evidently, if you use leverage you will have to pay for it. Its cost is relatively easy to approximate. For instance, one could use the same equation as in Part I: A(t) = (1+L)∙k∙A(0)∙(1 + r + α - lc% - fc%)^t. With the test result providing the answer for: r + α – fc% = 0.2817.
The following simulations were successively presented to the forum as I made them. They were the outcome of a trading strategy that was progressively modified to respond to the things I wanted to see. An exploration of the strategy's limits. The modifications all had some economic reasons behind them and could have been done by anyone.
#6 The $1M Scenario - Leverage 1.40
(click to enlarge)
With leverage at 1.40, the final output came in at a 41.59% CAGR. That is, it ended with a net liquidating value of $150,924,996 after commissions but before leveraging fees. The estimated total leveraging costs came in at $ 21,492,749. That is not pocket change.
Nonetheless, it would have left the account with a net liquidating value of $ 129,432,247. That is a 40.09% CAGR, net of all expenses.
Using leverage is a matter of choice and no one has any obligation to use it. It is like using or not a partial Kelly number or trying to set a 130/30 hedge fund.
Nonetheless, if your trading strategy can generate some alpha, a method to raise the stakes is to apply pressure where it matters. This can mean applying leverage, even if there is a cost to it.
It is why you do simulations of a trading strategy. It is to find out if it can handle it or not, and how well? You want the answers to: would I do it? Do I like it? Is it worth it?
I kept adding small modifications to the trading script. My next step was to raise the leverage to 1.5. Evidently, this would increase trading and leveraging costs (see chart #7).
#7 The $1M Scenario - Leverage 1.50
(click to enlarge)
At a 1.50 leverage, the strategy returned a net liquidating value of $ 209,247,238, a 44.84% CAGR before leveraging expenses which were estimated at: $ 34,537,174. This left a net portfolio value after all expenses of $ 174,710,165. Resulting in a 43.04% CAGR net of all expenses. It was more expensive, but, nonetheless, the net CAGR increased compared to chart #6.
To the question: was the 1.40 setting the upper limit for this trading strategy? The answer is: no, definitely not. This is not tweaking parameters, but the search for methods to increase two numbers, two portfolio metrics.
Without testing to see what a trading strategy might do using leveraging, we might not even be able to make a reasonable estimate. At least, doing such tests answer the questions: is it feasible? Would it be worth it? How much would it cost? And as said before: would I like it?
The modifications I made were not of the optimization type. Scaling and leveraging are outside strategy decisions to be made. And, as demonstrated, they can have quite an impact on the final result. This, even if leveraging has to be paid for.
What are the limits of a trading strategy?
How could you find them if not by doing some simulations seeking them out? Once you find them, you can then opt to stay within the confines of these limits knowing where they are.
Again, I changed a few numbers and pushed the strategy to behave as if on steroids.
#8 The $1M Scenario - Leverage 1.50 + parameter mods
(click to enlarge)
One reads correctly. That is $ 554,200,338 net liquidating value before leveraging costs. Sounds or looks exaggerated, but that is what came out of the test. A 54.96% CAGR.
There was no change in the trading logic and no new change in the trading procedures. Only constants that can have an impact on the final outcome were altered. These are not just constants or default values, but numbers that can affect the strategy over its entire trading interval as it unfolds.
This puts emphasis on the major contribution some rather minor parameter changes can have on end results. With such a wide range of outcomes as illustrated here, one might or should look closer at these parameters. They indeed can have quite an impact.
Even if the leverage was kept at 1.50, I opted to charge 0.80 instead of the 0.50 in the previous example. Total leveraging charges were over-estimated at $ 111,734,086, leaving a net strategy CAGR of 52.56% over its 14.42 years. A Pyfolio tear-sheet analysis had the gross leverage at 1.45 which is much less than what was charged to the system. I prefer over-estimating charges and fees to see how a strategy would have survived under more adverse conditions.
The end result left the portfolio account valued at $ 442,466,252 after all expenses paid. With such numbers, one should consider the impact and ramifications of trading big.
I would also conclude that the two previous examples (charts #6 and #7) were not the limit. BTW, this last one is not either.
Raising the Stakes
You raise the stakes, it has a direct impact on the overall picture. Technically, the chart itself won't change much. As a matter of fact, it should have about the same look if the trading strategy is scalable. What would change would be the scale. Its governing equation would still hold: A(t) = (1+L)∙k∙A(0)∙(1 + r + α - lc% - fc%)^t.
So, I went for k = 5, that is raising the initial capital to $5M using the same program.
#9 The $5M Scenario - Leverage 1.50
(click to enlarge)
Based on the simulation, the strategy showed itself to be close to 100% scalable. It ended with a 54.96% CAGR, the same CAGR as in chart #8. In numbers, the initial $5 million grew to $ 2,771,164,252.
Accounting for leveraging expenses which were estimated at $ 558,701,163, the account would have ended with a net liquidating value of $ 2,212,463,089 after its 14.42-year journey.
Hint: say a $100 million hedge fund took a 5% position flyer in such a trading strategy. They would get what is above, plus what they might get on their remaining $95 million. $95 million at a net CAGR of 15% (which is above average) would result in $ 713,294,976 over the same period. Giving the fund a grand total of $ 2,925,758,065. Thereby raising the fund's total long-term CAGR to 26.37%.
One has to look at the possibilities to see how far a trading strategy can go. Pushing where probably no one wants to thread.
Since the trading strategy was shown to be scalable, the next step was to raise its initial capital some more and go for the $10M scenario.
#10 The $10M Scenario - Leverage 1.50 + 1 character
(click to enlarge)
Yes, the number at the bottom of the chart is the liquidating value, before leveraging expenses. Leveraging was estimated at $ 1.25B, leaving a $ 4.99B net of expenses. Representing a 53.85% CAGR.
This series of tests showed that a trading strategy can have a wide range of outputs depending on the setup of its parameter and default values. Note that no program logic was changed, only numbers here and there. Raising the stakes did not alter the program, but did have a direct impact on the bottom line, where it counts.
This is why we should simulate trading strategies in the first place. It is not only to find if they could be productive, profitable but also to know if they can or will survive in their unknown future trading environment.
It explains why we should use general stock selection principles that could apply as well on past data as on future data. That we also set similarly general trading procedures. What some might consider as a "typo", an error, as was proclaimed in the Quantopian forum, I might see as a welcomed feature. As was the case in one of the iterations of this trading strategy.
The important point here is the alpha generation. If α > lc% + fc%, it will cost you more to do business, but it will also return more. The r + α is compounded, and to improve overall performance, the alpha needs to bring in a positive contribution. Therefore, be greater than the costs incurred to obtain it: α > lc% + fc%.
I might look at a trading program in a different light than most, but that does not make it wrong. It only makes it different. All the trading procedures I used in my examples are perfectly legitimate Python programming instructions. They all survived within their coded limitations. There were no errors in the code I used, mathematical, logical, or otherwise.
What makes this trading strategy so special? Nothing!
First, chart #1 showed that there was nothing there in the first place, no alpha. Chart #4 classified the strategy as a variation on a theme. It behaves the same as a simple moving average crossover system. It only reacts sooner because its lookback period is shorter than the one used in A Simple Stock Trading Strategy - Part III. Second, there is no hard data that says that a 90-day trend will continue. We are just making a statistical assumption that it may. Kind of drawing a line in the sand. Third, the 90-day decision point is the same as for a mean-reversal system which is bound to be right almost as often as its trend following counterpart.
Whatever your trading system, chart #5 should guide you in your stock selection process. If you want to go long, it says: bet on rising stocks.
What I consider the important part of the given equation is time. It is the compounding effect, thereby acknowledging that (^t) is what made my modifications fly. Admitting that there is no mathematical prowess involved. I only changed the trading strategy's behavior over time.
The trades are catching the averaged out random-like exponential drift in a rising market. The obtainable net alpha is compounded and it reverberates across the entire time interval. Even more so if you scale it up and put some leverage on it. Not excessive leverage, but enough to make it count, as long as it is all paid for.
It is good to know how far we can go in order to stay within our acceptable limits. And these acceptable limits is what differentiates every one of us. Our likes and dislikes are reflected in our trading strategies just as our perceptions of how the game should be played. And there, there are thousands of methods one could use. Of all of those, we usually end up finding the one or two that we like best.
We transfer to a program our trading instructions. It won't make excuses, it will simply execute its given code, whatever it is. That is what a programmed trading strategy does.
These simulations had for duration 5,625 days, it is not what one could call a weekend junket. It is also the time that might be required going forward. And, all those days will be lived one at a time. I get often the silly question: why are you not a gazillionaire yet? While a simulation can be run in a few minutes, it took 5,625 days to show its merit, and, that might be what it will take going forward.
I see a long-term trading strategy as a series of betting propositions, thousands of them in a sequential order, from start to finish. It is much like gambling, you don't win every trade, you have drawbacks, drawdowns, and you have good runs.
But, it stays a betting proposition based on some assumptions you may have of what the market might do. Often, it is a mathematical assumption, like the one used in this program which only says: buy and hold big cap stocks while their respective 90-day CAGR regression slopes are positive. Now, if you buy this, then chart #1 is your expected outcome. You would probably do even less since chart #1 under-charged its frictional costs by two-thirds. You definitely need to do more.
If you are ready to apply pressure where it counts, then your degree of trade aggressiveness might matter a lot more as demonstrated by my series of simulations.
Nonetheless, you need a long-term vision of the game to be played. Otherwise, you might be blindingly making one bet after another with no real purpose except just to play the game. It is with a long-term vision of the game that you can design some trading procedures that might be short-term bets but part of a more elaborate plan where you know you are going to win.
After having explored your trading strategy to see how far it could go. It becomes time for you to settle down. Choose within which limits you would want to operate your program.
You know your trading rules are sufficiently general in nature that they will apply going forward almost as they have in your simulation. Evidently, you won't get the same answers, you know that. But you also know that slanting up CAGR regression lines will be there from time to time for all the stocks you might wish to put in your portfolio. Making detecting stocks that might go up relatively easy. At a minimum, you can define it as your entry decision point to then live with it, and this is independent of what the market does. It is your view of the world.
You might now be ready to scale back down. I took the last version used and scaled it down to $100k while maintaining the leverage. Here are the results:
#11 The $100k Scenario - Leverage 1.50
(click to enlarge)
The strategy ended with $40 million, a 51.51% CAGR. Removing leveraging expenses would leave a net of $ 31.8 million. Giving, net of all expenses, a 49.11% CAGR. Turning $100,000 into $31.8 million (that is 9 times what was in chart #3, and 120 times what was in chart #1). It is all a matter of perspective.
The question has changed. It becomes: would you like to trade like that? And that too is a personal choice.
If there are things you don't like in a trading strategy, change them. Make it do what you want it to do. After all, it is just a program, and technically, it becomes yours to do with as you please since it was freely published for anyone to use and modify. In my case, it only served as a framework on which I could build starting with a do-nothing strategy (alpha-wise) to something more productive.
After all this exploration of the possibilities, we get to the point where we can improve on the trading procedures themselves. Press on the inner strengths, and address some of the weaknesses. All within this long-term plan, this vision of where you want your trading strategy to go, and this, on your terms. This also says: you can do better.
This trading strategy is described by the two charts (#4 and #5) in Part I of this article. These charts say you can enter a trade when the 90-day CAGR is above a positive threshold which you can set. Based on chart #4, the holding period coincides with the major part of the upswing in the price movement. On the downswings, stocks are not even considered as candidates as illustrated in chart #5.
That is the protection against major drawdowns. If a stock is not rising, it is not in your portfolio, that simple. And, it is a sufficient protection. Each stock in the portfolio as it fails the upward slanting test is sold. Not to be seen until the regression slope slants back up again.
No need for a stop loss or profit target, the exit is built-in. We can characterize the strategy as a trend follower. You have an excuse to select rising stocks, and another excuse to execute in and out trades. All that is left is to manage the portfolio, guide it to where you want it to go.
When you look at the test results, you realize that you had no control as to which stocks would be picked, when they would be picked, and how many shares would be bought. You only knew that it had to happen at some time, and only a fraction of available candidates might be selected. On average, selectable trade candidates hovered around 175 (ranging from as low as 0 to 200+). From the selectable, most often 10 to 30+ stocks would be part of the portfolio. This limitation mainly due to the limited leveraging and available cash reserves. Note also that at times, the strategy had very low exposure, meaning that it was then mostly in cash with only a few positions opened if not none. These periods coincide with market drawdowns, like during the financial crisis for instance.
I did see some limits, but these limits were of my own doing. All described in the trading procedures and parameter values. It is as if having a chainsaw design, very rough. But even in that state, it worked, it was productive. It leaves much room for improvements. It is a reasonable bet to make the assumption that buying an upswing is better than no entry excuse at all as if buying on what might be an equivalent to a random-like decision process.
A prior version of this trading strategy, the one which generated chart #6 is still available in the cited Quantopian forum. Don't use it as is, explore, and understand what it does first. See if you can adapt some of it to your own trading style. If ever you use it with whatever modifications you might bring to it, it will be your money on the line. Therefore, test it exhaustively to your own satisfaction just as I did. In the end, it will be you that will press enter.
The version I am still testing has some added modifications and the particularity of using a double log selection process tempered by its R-squared value. What it does it this: it enables to pick on average high cap stocks that are having an acceleration in their price movement in their upward breakout above a given threshold. The R-squared dampening will favor the stocks that have been in a tight consolidation phase over the past 90 trading days since they are the ones having the highest R-squared value. And once a stock is picked, well, you're in. That it accelerates some more does not matter. It is only when it will slow down, after the top of its swing, that it will be considered a sell just for slowing down (see chart #4). All this is acceptable. And, it should work going forward too.
This does not make it a predictive trading strategy. In fact, to show that it does not, simply look at chart #1 again. All it could do was achieve close to market averages, the equivalent of throwing darts at the financial pages of your newspaper. You do not need predictive powers or anything else to reach that level. It is given just by participating in the game and buying some index fund.
As I see it, it opens a door that lets you be in charge of what you might want to do, and that is built over the long term your own retirement or investment portfolio. However, before engaging in this, study the methodology, make it your own, modify it to answer to your own criteria, and know why the strategy behaves the way it does. Then, you will also know why it worked, and how far you might want to go. You will be left with the decision: do you want to execute chart #1? Or, do you have the capital, and the guts, to go for chart #3, #6, #7, #8, #9, or #10? Or then again, will it be chart #11, the $100k scenario? It is only then that you will gain the needed confidence to let it do its job.