Back to Community
What I Have Seen Over The Past Few Weeks

Most of the stocks have become restricted. At least, that is what I saw on my IB stocks of interest watchlist. Programs depending on shorts, like market-neutral trading scripts, would not have found that many shortable trades due to all the restrictions. In a period such as this, leveraging fees would be higher due to the rarity of borrowable shares. And furthermore, maintenance margins were also reduced making it even more difficult to stay long.

Rebalancing on a monthly or quarterly basis might have missed the most recent 3 to 4 weeks. Again rendering a lot of strategies helpless and having to endure those drawdowns. Drawdowns that they had planned to minimize with their code but became ineffective stop-loss procedures that have had no time to be applied or triggered. Thereby, bypassing even those basic protective measures.

It is only if you were short before this crisis when shorts were widely available and much riskier that you could have suffered lesser drawdowns. But, then it would also depend on their severity, by how much your longs would be punished. Would your program, for some reason, have switched to cash prior to the crisis and on what rationale?

Long only strategies, if using weekly rebalancing would also have been clobbered. Especially if they relied on quarterly fundamental data and using the optimizer to make their trades. They would still be operating on December data which did not show any trace or any hint of a pandemic.

Shorts had the up-tick rule restriction reinstated. But that applied only on the retail side of the ledger. Market makers had no such restriction. I do think that sub-penny trades were still allowed for big players and market makers, but not for retail traders. SHO rules still allowed naked shorts for market makers.

But whatever, this whole market now presents tremendous opportunities going forward. We all know it will all bounce back. It is just a question of time, but it will get there eventually just as it did in the past after such black swans.

13 responses

I agree that market presents tremendous opportunities now and moving forward.
However, my view is that this flock of black swans just triggered new great recession and possibly even a depression and that it could take many years to get again to ATH and not few weeks or months like it did so far.
Entire world is in lockdown and people are scared.
The only fast new ATH I see is inflated one if FED decides to create double digit trillions out of nothing and pump it into economy combined with potentially found coronavirus cure.
Even with that it would take quite some time for economy to start moving at full speed again.
Also, this crazy recent volatility is perfect playground for many subsequent dead cat bounces.

@Vedran, my point was that of the published trading strategies I have seen on Quantopian, none were ready or programmed to adequately face this fast and general collapse in stock prices. None of the fundamental data (especially if it was held back one year) could foresee what was coming.

When designing protective measures, there is definitely a need to code for such possible phenomena even if they do not happen often, because when they do, they can do quite a lot of damage.

It is our task as strategy designers to code not only for optimal profits but also for optimal capital preservation. Even if such a measure is simply stepping to the sideline.

@ Guy ,

of the published trading strategies I have seen on Quantopian, none were ready or programmed to adequately face this fast and general collapse in stock prices.
Do not agree.
There are thousands balanced, long only strategies published on Quantopian forum which are making new high today.
Like this one, we discussed with Yulia Malitskaia in "Quantopian-Based Paper on Momentum with Volatility Timing".

Click to load notebook preview

@Vladimir, great.

Yeah, just as @Vladimir pointed out. Many of our long short algos are having time of their life. Just take a look at daily contest leaderboard.

@Vladimir, made a walk-forward out-of-sample test based on the strategy I presented on my website last January.

Here is my follow-up article: Financing Your Stock Trading Strategy II.

I would amend my previous statement: there are some trading strategies that might not break down during these historic and volatile market moves. A simulated walk-forward test, just as you did, would tend to show this.

The attached notebook shows the same equity chart as used in your notebook for comparison.

[Updated June 26, 2020: added HTML version of notebook in order to properly display charts]

https://alphapowertrading.com/quantopian/Ranked_Selection_NB.html

Click to load notebook preview

I like the notion of doubling times for a portfolio. It indicates, on average, how much time was required for the portfolio to double in value. It is all a matter of the strategy's CAGR, its compounding rate.

For instance, Mr. Buffett has had an average CAGR of about 20% over the years. From my chart in the Stock Portfolio Doubling Time article, this implies a doubling time of about 3.81 years on average.

Based on the same chart, the higher the average CAGR, the shorter the doubling time, as should be expected.

Why should this be important?

Simply because this portfolio management thing requires years to unfold, many years. Mr. Buffett managed to maintain his average CAGR for 50+ years, doubling his portfolio every 4 years or so. It does not mean that there were no drawdowns, there were. He has often said he has had drawdowns in excess of 50% four times. His current drawdown is about 30% or so. But, I am not worried, he will rebound again.

The portfolio performance illustrated in my prior post might appear exaggerated to some. But in terms of doubling times, not that much. James Simon's Medallion Fund has been operating at an even higher rate. So, it is not impossible.

The November simulation gave a doubling time of about 1.85 years compared to the April results which averaged at 1.72. Most of the drop in doubling times is due to the huge profit increase in the last few months of the walk-forward. It does say that even a small change in the average doubling time can have quite an impact, especially in the later years of a trading strategy where the bet size was increased considerably. Whatever the trading strategy, in a fix-fraction scenario, you have to be ready to make those larger bets and take those large positions as the portfolio grows.

It is extremely difficult to reduce the average doubling times over the years. The reason is simple: CAGR decay, the law of diminishing returns. There is a need to compensate for this and there are tools to do so (I wrote a book on that).

Trading Is Not The Same As Investing

Trading is basically about two numbers: the number of trades executed and the average net profit per trade. Both numbers are given in the backtest analysis when using the round_trips = True option.

The task in trading is making sure that those two numbers increase with time. But no matter what, you are still subject to the math of the game. In trading, the market can offer a lot, even a lot more than what I presented. There is no secret to the math behind the methods of play.

Many times in these forums I have stressed the importance of the betting system used when faced with uncertainty. We can certainly say that the market lives in this tumultuous ocean of variance and that it is rather difficult to predict which way it is going to go from day to day. But, as a trader, you still have to find ways to make your own doubling time.

If your strategy's doubling time is 14.25 years, equivalent to a 5% CAGR, you are not going that far that fast. And if your initial stake is relatively small, it is even worse since: \( F(t) = F_0 \cdot (1 + 0.05)^t\) might not be that big even after 28.5 years on the job \(\approx 4 \cdot F_0\).

Doubling Times

The sequence for the first 10 doubling times is (\(2^n\)): 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. Each 50% drawdown makes you lose a doubling time, and as time progresses, the value of this drawdown increases. For instance, dropping from 4 to 2 does not appear so bad when compared to the drop from 1024 to 512. That drop is 512 times the initial portfolio! Yet, both had a 50% drawdown. One should get to the conclusion that preservation of capital becomes more and more important as you move along the doubling time sequence.

Mr. Buffett managed over 14 doubling times so far. His last doubling time was for as much as he ever did in the previous 13 doubling times. It is remarkable. And his 15th doubling time will be as much as he has done over his entire career.

Every percent you add to your portfolio's return will have an impact on this doubling time.

You often see me using equations to explain what I do in my trading strategies. One that might be misunderstood is the payoff matrix, and yet, it is so simple and elegant:
$$F(t) = F_0 + \sum^n (H ∙ \Delta P) = F_0 + n ∙ x_{avg} = F_0 ∙ (1 + g_{m} + \alpha \; – \; ex)^t$$ with \(n\) the number of trades and \(x_{avg}\) the average net profit per trade. Increasing both these numbers over the trading interval will result in higher profits, other things being equal. If done over the same time interval, it will increase the CAGR.

You Are The Strategy Designer

That your strategy makes 500,000 trades at an average net profit per trade of $10, it will produce the same amount as another trading strategy making 50,000 trades with an average profit of $100.

You are the one to design that trading strategy using rebalancing or whatever other technique which will dictate how many trades the strategy is bound to make within its portfolio constraints. It becomes which strategy will produce either of the above two scenarios or anything in between or above. The strategy making 500,000 trades might not be the same as the one making 50,000 trades.

For sure, my trading strategies do “fly”. Not all of them, mind you, as should be expected. I do throw some away.

In this case, it should be noted that it took some 17.19 years of compounding to get there with progressively larger bets executed in order to achieve those results. There is math underneath to support them.

In a sense, in the end, the way I see it, you are the one to choose your portfolio's doubling time. It is all in your payoff matrix strategy design \(\mathbf{H}\).

The attached notebook is based on the same program as in my January article: Financing Your Stock Trading Strategy

Here it is tested (April 25th) compared to its last iteration April 6th (see previous post). The added 3 weeks, even if it is a small incremental time interval compared to the strategy's 17.16 years still represent a walk-forward and an out-of-sample simulation.

[Updated June 26, 2020: added HTML version of notebook in order to properly display charts]

https://alphapowertrading.com/quantopian/Ranked_Selection_NB-2.html

Click to load notebook preview

My previous post demonstrated the application of a trading strategy's payoff matrix equation where the bet sizing was gradually increased to comply with equity: \(F(t) \div j\), and where \(j\) was the number of stocks in the portfolio. In the above case, \(j = 400\) stocks were used.

Any bet taken was 0.25% of the ongoing equity. It also meant that as time progressed, the bet size would increase at the same rate as its equity line. It is the compounding for 17.16 years that makes the difference. There is no secret “stuff” here. But, compounding at a high rate for 17.16 years has to show up somehow.

To achieve such numbers, the trading strategy had to supply all the needed funds internally. All trading profits were continuously re-invested, over and over again. But, even this internally added funding generation would have been insufficient to produce the seen outcome. The strategy uses some leverage. In all three cases since the January article, the leverage has hovered around 1.55 to 1.57 while maintaining about the same level of drawdown and volatility.

I understand that some do not like leveraging. It is their choice. But, in many cases, it can be an accelerator. It is why I do make an estimate of its costs and have that cost printed on the equity chart.

Leveraging has a cost, evidently, that is not a question. In the program, I used 4% leveraging fees when IB charges 1.55%. But, that is not the point. The point is that leveraging can help productive strategies do even more. In my program version, leveraging was modulated. It was not a constant. In periods of market turmoil, it was pushed way down while it was increased in rising markets, but only up to a limit. Raising the leverage to 1.60, for instance, would translate to even more profits, even if it is a relatively small incremental change. The payoff matrix equation would gradually slightly increase its bet sizing as it went along.

Whatever the payoff matrix you design, you can have your trading strategy do nothing more than the other guy, or you can force your trading strategy to do what you want or find ways for it to internally generate its own funding (using its ongoing profits) in order to accelerate your performance to higher levels than just achieving market averages or below.

In my previous post, I stated:

“Raising the leverage to 1.60, for instance, would translate to even
more profits, even if it is a relatively small incremental change. The
payoff matrix equation would gradually slightly increase its bet
sizing as it went along.”

I do not like to say things and not corroborate them. Therefore, I did the simulation, raising the leverage by 3% to 1.61. Evidently, it would translate into higher leveraging fees, small amounts in the beginning but still growing larger in parallel with equity.

Overall, it would have cost the equivalent of about 5% of the portfolio's ending equity, looking at it more as an added cost of doing business. But those added expenses were more than compensated for by the added profits generated. In that department, profits did increase, going above the presented results in my prior post by $2,129,355,839. I should re-emphasize that it took 17.16 years to get there, and compounding plays a major role in the payoff matrix equation.

Raising the leverage, even by a low 3% had for impact to increase the bet size of all trades. Redistributing the available equity differently to the 400 stocks in this portfolio.

By increasing the bet size, you also tended to increase the average profit per trade. By comparison, the last test had an average net profit per trade of $74,341, while this new simulation with its 1.61 leverage had an average net profit per trade of $89,453. Increasing the average net profit per trade by $15,113 per trade. And since the strategy did make 143,610 trades, it all added up.

You only have 3 numbers to take care of: \(n\), \(u\), and \(PT\). Might as well make the most of them. And \(u\), the trading unit is a major part of it.

Increasing the leverage by 3% is not a curve-fitting operation, it is a structural thing. A choice one can make independent of what the trading strategy does or how it does it. Leveraging allows larger bet size, it is like putting more capital on the table. It is worth it ONLY if the added profits you get exceeds the leveraging cost. In this case, it was effectively demonstrated.

On the other hand, say, you do not want to increase the leveraging, you could always accept the results of the previous simulation, or push it down to whatever level you feel comfortable with, including no leveraging at all. Evidently, going for no leveraging, you should not expect the numbers that have been presented in the above simulations.

[Updated June 26, 2020: added HTML version of notebook in order to properly display charts]

https://alphapowertrading.com/quantopian/Ranked_Selection_NB-3.html

Click to load notebook preview

This is something like the 4th walk-forward for this trading strategy. Adding 6 more weeks to the last simulation while maintaining a gross average leverage of 1.56x. The simulation was done only to show what was possible. It does compare favorably, profitwise, to the prior 17-year test. Overall, the added return did not even increase the drawdown, or the volatility, for that matter. But then, who's counting?

[Added] June 22. The attached notebook does not display any of the charts. So, here is a HTML version of the same. This way you should at least see the charts.

https://alphapowertrading.com/quantopian/Ranked_Selection_NB-4.html

Click to load notebook preview

This is an added test to the last walk-forward post. It uses the same strategy where it was asked to use 1.60x leverage compared to 1.56x in the previous post. That is a 3% increase in gross leverage. It is not a major change to the trading strategy. Nonetheless, using higher leverage will increase leveraging costs.

The simulation is done to demonstrate that the increased leverage is sustainable over the entire trading interval. If you do not do the test, how on earth would you know that your trading strategy can handle it? So, technically, this should be part of your arsenal of acid tests for your own trading strategies. No one is forcing anyone to do those tests. However, it is where just an opinion that your trading strategy can support an increase in leverage is not enough.

Since putting charts in an attached notebook does not seem to work, I will skip that process and provide the HTML version generated by the notebook.

https://alphapowertrading.com/quantopian/Ranked_Selection_NB-5.html

I will let you compare the above HTML file to the one in the previous post.

What is shown in those charts is the impact of the added 3% in leverage. It increased overall return by some 21% which by itself would tend to justify at least validate the use of the added leverage.

But, then again, no one is forced to use leverage. It is always a matter of choice, preference, and risk averseness.

The above-cited strategy is one of the most phenomenal on this site with a 56.6% CAGR over its 17.3-year simulation while trading some 400 stocks at a time. The strategy made some 144,764 trades over the period. More than enough trades to start talking about averages, trade mechanics, and general behavior while still facing uncertainty.

My strategies use equations which I have provided many times before. I think anyone applying these equations could adapt them to their own tastes, circumstances, and constraints. Especially, the risk averseness part of the problem. Also, I do estimate that there are gazillions of possible solutions that could adapt to one's trading preferences.

We need to comply with the provided equations. We don't have to, evidently, but that won't make them go away. In fact, if you want to trade and succeed outperforming long-term market averages, that equation will always be in your way until you start understanding what it is and what it can do for you. When I say: “what it can do for you”, it is more how you could enhance your trading strategy by applying pressure at specific points which might marginally increase market risks but also provide better overall returns. There seems, most often, to be higher costs and higher risks in doing more business. This also applies to trading.

What I think is not that understood in the way I treat a trading strategy is the methods used to enhance portfolio performance. First, I cannot extract blood from a rock. I cannot beat heads or tails. And should the market be considered purely random, I could not win that game except by luck. I cannot predict which stocks will be there in 20 years from now or by how much. I cannot be sure which stocks will be up next week. I do not even have a probability measure for that either.

However, the thing I can do is design a trading strategy in what I consider a quasi-random trading environment where I can take advantage of the long-term upside bias seen in stock prices. It does not give me predictive powers, but I can design trading procedures that will take advantage of a long-term upside market bias when the market noise moves in my favor meaning that when some of the stock prices go up, by no fault of my own, I can still take part of that “paper” profit to enrich the trading account.

It is what you see in the above-presented strategy. I have no predictive powers, but using the portfolio's payoff matrix, I can “inject” my own guidelines into that equation to technically partially control its behavior. This can be done even from outside the program by reading a file of the ongoing controlling variable settings which I consider the pressure points having an impact on the strategy's final outcome. With this process, you can direct your program to do a little more of this and a little less of that on an ongoing basis. Technically, overriding your program as you see fit. This makes your program more than unique, it becomes your sentiment-driven personalized version.

It is a CAGR game, a small variation in the structure of the program, such as in the bet sizing function, can be propagated exponentially over the entire trading interval thereby affecting all trades. In the beginning, it is not a major change. Something like in the above-illustrated strategy where it was “requested” to increase leveraging by 3%, going from 1.56x to 1.60x. Yes, it did increase trading expenses. But, it also increased performance to such a level that the added profits more than compensated for the added expenses.

I would stress the point that I do not necessarily wait for a factor or an indicator to influence a trading decision. I inject into the payoff matrix equation my own considerations of what the strategy should do, forcing it to outperform on terms that I consider acceptable. Something like a compromise asking: can this trading strategy support a 3% increase in leverage?

I often try to push strategies to their limits to then scale back to within my own risk tolerance. This way, I at least know that the strategy can support it if needed or desired. For instance, increasing the gross leverage by an additional 4% would certainly have an impact even though it still might not be the program's limit yet. Doing so, it raised performance with a slightly higher drawdown (going from -30% to -32%). The question would be: would you support the added 2% of drawdown? See the HTML file below for an answer.

https://alphapowertrading.com/quantopian/Ranked_Selection_NB-6a.html

(The above HTML file was generated in its notebook. When attaching a notebook, my charts are not displayed for some reason).

The concept that should be retained here is the use of the portfolio payoff matrix to inject “my own do this thing” on top of what the market is doing, thereby, generating some controlled alpha since “my own do this” are more like outside administrative procedures instead of relying on the strategy to do its thing based on some factors or indicators. Operating differently than most does not make the trading procedures bad or wrong, they only make them different. And from the above simulation, more than quite productive, to say the least.

The stock market is not there to give you money, you will have to work for it, and for a long time if you want to make it worthwhile.