Nov. 16, 2020

Following Quantopian's shutdown, some of Quantopian's members moved the In & Out strategy to QuantConnect. I moved there too and started reading the documentation. Also started analyzing this adapted strategy and doing some simulations of my own. The following is my first post on QuantConnect relating to this freely cloneable strategy.

One could do so much more with this trading strategy simply by gaming it, albeit at a higher trading cost but that should be expected.

You want to do more, you will have to take on some incremental risk while bringing in more capital. I accept limited leveraging as a means to this end as long as the trading strategy can more than pay for the added costs and added risk. It is the classic risk/reward consideration everyone is facing.

Let's do an example. Split a $1M trading strategy C into two portfolios: C = A + B. Put $900,000 in strategy A and $100,000 in strategy B. Portfolio B is the 10% of portfolio C put at some anticipated higher risk.

You make strategy A track a market index (Ex. QQQ, SPY, or DIA) or whatever with an expected 10% outcome over those 13.24 years. Thereby, portfolio A's expectation: E[A] = $900,000 ∙ (1 + 0.10)^13.24 = $3,178,935. If you could add 0.10 as alpha to that scenario it would push portfolio A higher: E[A] = $900,000 ∙ (1+ 0.10 + 0.10)^13.24 = $10,060,098. This 10% alpha is something you will have to bring to the table, either by luck or using your trading skills.

Portfolio B puts into action the In & Out strategy presented in the QuantConnect forum, but with some modifications. Instead of using QQQ, let it use TQQQ as the ETF for the upside. TQQQ trades some 75,000,000 shares per day, so you can get “in or out” of TQQQ with relative ease even if you played thousands of shares at a time. Nonetheless, it is a 3x leveraged ETF.

I would not be holding TQQQ for the long term since it might not outperform market averages. For instance, over the last 10 years, TQQQ had a 6.9% alpha with a beta of 3.38 resulting in a mean annual return of 4.17% (as of yesterday). However,... this is a trading portfolio and things get to be different. You will be getting in and out all the time, almost swing trading the thing.

The reason holding TQQQ for the long term is technically suboptimal is due to its very structure. It cannot escape the consequences of multiple 20% swings: (1+ 0.20) ∙ (1- 0.20) = 0.96 and not 1.00. You repeat this 20 times and you get: [(1+ 0.20) ∙ (1- 0.20)]^20 = 0.44. This means that with a 50% hit rate, and a long-term time horizon, it will make you lose more than half of portfolio B's potential just because TQQQ rebalances its 3x leverage every day. Also, drawdowns, due to the leveraging, are amplified by this factor of 3. Therefore, there is real caution to be had here.

For portfolio B's protection (more your protection) you continue to force it to switch to bonds on any hint of market turmoil. We could design better ways, but for the moment, let's stick to the program's code. Strategy B's switching mechanism appears sufficiently sensitive to act as a running global stop-loss. It is probably the main reason why none is explicitly given in the strategy since it was not needed or necessary.

But, how far can you push portfolio B?

In my tests, I reached in succession: 32,560%, 45,641%, and 52,428% by adding stuff in my exploration for the strategy's limits. That is a CAGR equivalent of 56.67%, 60.93%, and 62.67% respectively. Therefore, you could get for outcome: E[A] + E[B] = 0.9 ∙ C ∙ (1+0.10)13.24 + 0.1 ∙ C ∙ (1+0.6237)13.24 = $65,942,970. Strategy B producing 95% of total returns making portfolio C operate at a 37.21% long-term CAGR equivalent.

The 52,428% test for strategy B produced the following charts:

Equity Curve – Strategy B
Equity Curve


Portfolio Metrics – Strategy B
Portfolio Metrics


What was at risk?

To give portfolio B some initial leeway, you activated a one-year trailing stop-loss at $100,000 after its first year of operation. This way, if strategy B failed thereafter, you would get your money back plus the results from portfolio A. So, the same formula as above would give: E[A] + E[B] = 0.9 ∙ C ∙ (1+0.10)13.24 + 0.1 ∙ C ∙ (1+0.00)13.24 = $3,278,935 for the no alpha scenario, and E[A] + E[B] = 0.9 ∙ C ∙ (1+0.10 + 0,10)13.24 + 0.1 ∙ C ∙ (1+0.00)13.24 = $10,160,098 with the 0.10 alpha accounted for. The loss on portfolio B would be the lost return (a kind of missed revenue opportunity) of $253,215 since you got back your initial capital but with no profits.

Over the long term, with portfolio B remaining active for the duration, the expected gain for portfolio C would have been: E[C] = E[A] + E[B] = $65 million as expressed above.

The consideration becomes will you implement strategy B in concert with strategy A or some variation thereof?

Portfolio A offers a consolation prize in the range of $3,278,935 to $10,160,098 or more with more alpha. Portfolio C on the other hand (including an active strategy B) offers $65,942,970. Based on my further tests, It could do even better. It is really a matter of choice.

Regardless, you can still do even more.

For instance, using an 80/20 initial fund separation would give: 0.8 ∙ C ∙ (1+0.10)13.24 + 0.2 ∙ C ∙ (1+0.6237)13.24 = $128,353,791. Notice that the 80/20 split is an administrative decision, in a way saying it is your decision and not the program's decision.

Why use portfolio A with such results?

Simple: in the beginning, portfolio A (due to its size) acts as a damper; a volatility and drawdown buffer. While at the end, portfolio A is just a small fraction of the whole (less than 3% of portfolio C).

Happy trading to all.


Related Article:

Going For Better Portfolio Returns

Nov. 16, 2020, © Guy R. Fleury. All rights reserved.