Nov. 1, 2020
The Quantopian community website has shut down. All links to Quantopian posts have been disabled.
I was about to answer a question in a Quantopian forum when they opted to shut down their community website. Here is that post anyway. It is trying to answer: could someone use stocks based on highest relative strength above a market average proxy? The strategy's code was given in the thread titled: New Strategy — “In & Out” where anyone could make a copy of it and then modify it at will.
I had this prepared answer, so figured it would do no harm to provide it anyway before everything was erased. I will definitely miss Quantopian participants and would like to express my thanks to all for their comments and contributions over the past few years.
To the question, yes, why not? You are taking 5 stocks out of 100 possible choices. There are some 75,287,520 combinations. I used one out of those where the individual returns were above QQQ as the simulation progressed. I do not think my choice was optimal since I do not know the outcome of the other 75,287,519 possible choices, and I do not intend to even find out. However, common sense would dictate that selecting stocks performing above market average would produce above-average returns.
In that forum, I presented 4 test results in succession based on that strategy. The gross leverage used was 1.5x or less and leveraging fees represented less than 3% of final CAGR outcomes. I consider those fees as an added cost of doing more business.
The point is that our trading strategies have to generate all the profits from within however they are structured. And leveraging can be used to accelerate the process.
Some think that the above results are beyond belief when in fact I consider them just ordinary, a result of the applied math. It is all part of my search to find the merits, limits, strengths, weaknesses, and overall potential of the trading procedures used.
It is the trading that enables the repeated reinvestment of the ongoing profits. This reinforcement feedback loop will compound results and increase overall returns. I will not be able to continue improving this strategy for a while due to Quantopian's shutdown, but somehow, I will be able to do it somewhere to see how far it can go.
Before all backtests were erased, I recorded all their respective total returns in order of occurrence and produced the following chart. I wanted to see the progression of total return improvements each author contributed to the base strategy. Thought I would also share that before Quantopian's final shutdown.
The four outliers are all mine, they have been illustrated in the first chart above. We can see from the chart that there was indeed a progression to the program modifications being applied. Also, from the previous chart, the portfolio metrics were relatively close: Sharpe, Sortino, Beta, Volatility, and Max Drawdown did not see statistically significant changes. Nonetheless, as the total return increased, it was expected that volatility and max drawdowns would increase in step even if the change was relatively small. For the moment, my efforts to improve this strategy further have been temporarily short-circuited.
My point from the above chart would be: if you could do any of those 4 outliers, then all other modifications shown should be considered greatly sub-optimal. But then, that is my point of view. And again, it all boils down to a matter of one's choices and program procedures.
The reinforcement feedback loop concept is not new, it is not complicated, and is supported by math. We are playing a CAGR game, and therefore, leveraging will also be compounding. I presented the following equation many times in my writings:
F(t) = (1+ Lev) ∙ F0 ∙ (1 + (1+ Lev) ∙ (rm + αt – expt) )t
Use the equation in Excel and put in your own numbers. It will be easier to understand the high-performance level shown in the above chart due to minor changes in alpha and leverage. Evidently, if your alpha generation is negative, it will amplify that too, and could make it an “unreasonable” quest.
The stuff we design is static for the duration of the simulations when in reality we need more dynamic and evolving structures which is why I like some outside control. But, even if we technically freeze our programs in a particular state for the duration, we can still show the merit of the underlying trading procedures.
The above equation does state that leveraging has the same effect as increasing your initial capital by the leveraging factor used: (1+ Lev) ∙ F0. It also says that it will increase your trading expenses. But most importantly, it will also directly boost your market return and your generated alpha. It has for requirement that your alpha generates more than the added costs. Evidently.
It is as if we could determine the underlying trading philosophy and general objectives of such procedures. For instance, the program declared a BULL variable that dictates (at all times) what should be done. Its degree of accuracy played a major role in the strategy's outcome.
It had another role which was to determine when you should switch out of risky assets for the safety of bonds and vice versa. It had many false positives and false negatives but nonetheless turned out to be right where it counted the most. Another side effect, it also acted as a generalized and flexible stop-loss mechanism. Leveraging could be used when BULL had declared the market to be in an upswing, and that is not necessarily bad as shown in the above charts.
Nov. 1, 2020, © Guy R. Fleury. All rights reserved.