Sept. 10, 2020

*The following was posted in a Quantopian Forum expressing **my point of view on the highlighted stock trading strategy.*

No one seems to be much concerned by the stock selection process used when it has a major role to play over the long term. First, let's set “long term” as 15 years or more. I would prefer 20-30+ years, but we do not have that much data available.

I used Dan Whitnable's version of the initial program as highly representative of the various versions I looked at. I could have used other versions, but I do like Dan's programming style.

**A Trading Strategy**

The strategy has a “self-proclaimed” definition for “quality” and “trend”. The trend is up if the SPY 50-day SMA is higher than the 200 SMA. The trend is down otherwise. A simple SMA crossover triggering system used by many of the program versions. Whereas quality was set as the sum of the ranked scores of *stable earnings, strong balance sheets (low debt), high profitability, high earnings growth, and high margins*. Conditionals were applied to extract stocks from the selected stock universe. The portfolio was then scheduled for periodic rebalancing.

We assume it is all good and do not even question the premises since they all sound logical and reasonable. But, are they really?

**Redesigning It**

I questioned everything in this strategy, even the stock universe used, to gain a better understanding of its structure and all its nuances. I ended up modifying every important aspect of it: changed premises, initial assumptions, stock selection method, trading logic, goals, and methods of play. Added modulated leveraging with boosters and amplifiers where I thought they should apply as general rule, that they be mostly profitable, even if at times not.

Trading, by its very nature, and due to the high number of executed trades (>100,000), becomes more a statistical undertaking where playing unknown and developing averages tend to dominate the scene. The most important of them is the average net profit per trade x_{avg} . Evidently, you end up with a profit if, and only if, x_{avg} > 0.

I like designing trading scripts and push them beyond their limits (using whatever) in order to scale them back later knowing that they could go further if wanted. All I can do is make a simulation of those trading principles and rationales to see if it would have worked on past data, and maybe from the simulation make estimates of how much such strategies might produce going forward. Like in many other training and/or forecasting endeavors.

Simulations, once done, need the test of time as corroboration going forward. It might take years to show a strategy's live merit. It is why we do simulations in the first place. We want to know now if the designed contraptions have value.

**Understanding Better**

Simulations and their variants can provide a better understanding of the trading logic and interactions between all the variables having some impact on a strategy's outcome. The future will be different, we all know that. But still, a program is code and it will execute its commands. Will the market be the same going forward? Absolutely not, but your program might be the same if not modified along the way!

We are all entitled to trade whichever stock is out there using whatever trading methods we have. Therefore, again, why choose those stocks? Why choose that particular stock universe? Why force that particular selection when there are trillions and trillions of other possibilities? There are even more basic questions to ask.

**The Portfolio's Payoff Matrix**

The point I raised using the portfolio's payoff matrix equation is that there IS an equation for a rebalancing portfolio:

F(t) = F_{0} + Σ (**H** ∙ Δ**P**) = F_{0} +**E**[n ∙ Σ (**H** ∙ Δ**P**) / n] = F_{0} + y ∙ rb ∙ j ∙ **E**[tr] ∙ u(t) ∙ **E**[PT]

What is the average long-term probability that the expected average net profit will help you exceed your long-term objective P[E[n] ∙ x_{avg} > z]? And a corollary, how could you improve on z? But first, let's look at the stock selection process itself.

In the above payoff matrix, Δ**P** is simply the price difference matrix of your selected tradable stock universe. It has for origin the price matrix **P** which is the same for everyone. If there is one thing in the payoff matrix that you do not control, it is the price matrix. Either of the following stock universes could have been used: “*Q500US, Q1500US, QtradableStocksUS, Q3000US, USEquityPricing*”, and each would have provided a different answer to the applied code.

**Trade Timing**

The timing of most trades and their respective quantities would have been different simply due to the selected universe. The outcome would even change if you changed the starting date by a month, a week, a day, or even by an hour for that matter. As you would increase the size of the stock universe, the ranked set of selected stocks would not be identical at each rebalancing, nor would their actual rankings. Yet, the strategy's trading logic would be the same.

In my case, it would have taken the 400 highest ranked momentum stocks of the lot to which would be applied my tailored trading unit function, a variant of the multitude of other possibilities. This says that everyone could have a different solution to the problem and win. So, my suggestion would be: design your own and do not make it public. At the very least, do not give away your best solutions. My intent is to help you design your own solution and not to give you mine. Without understanding what you will do and why what level of confidence would you give your trading strategy solution and what would be its real worth?

**Rebalancing**

In previous notes, I emphasized that we could make an estimate as to the number of trades a rebalancing strategy might make over the years. Its formula was simple: **E**[n] = y ∙ rb ∙ j ∙ **E**[tr], where y was the number of years the strategy would run, rb the number of rebalance per year, j the number of stocks in the portfolio, and E[tr] the expected turnover rate. The bet sizing function was defined as u(t) = F(t) / j = F_{0} + Σ (**H** ∙ Δ**P**) / j with F_{0} the initial capital.

What does it all say? It says that initially, all you have is your initial capital that could be moved around according to the ongoing value of the trading unit function u(t) and that this function is subject to your ability to generate profits. In fact, generating alpha is totally dependent on your trading strategy **H**. The higher the average net profit per trade, the better since your portfolio is highly dependent on it:

F(t) = F_{0} + y ∙ rb ∙ j ∙ **E**[tr] ∙ u(t) ∙ **E**[PT] = F_{0} + **E**[n] ∙ x_{avg}.

Moreover, by increasing the number of years you manage a portfolio, the higher the expected outcome. You increase the number of stocks in the portfolio and you should expect higher profits, but, this move also decreases the bet size. You increase the number of rebalances, and it should improve on performance, but this would tend to reduce the average percent profit per trade. As if there was always some kind of trade-off to be had.

**Seeking Volatility**

Nonetheless, here is an interesting observation. In a rebalancing portfolio such as this one, and keeping all other things equal, that you increase the number of stocks to be traded will have little impact since the bet size will be reduced proportionally u(t) = F(t) / j. For instance, doubling the number of stocks will half the bet size:

F(t) = F_{0} + y ∙ rb ∙ (2 ∙ j) ∙ **E**[tr] ∙ (u(t) / 2) ∙ **E**[PT] = F_{0} + (2 ∙ **E**[n]) ∙ (x_{avg} / 2).

Nevertheless, the move would tend to reduce the portfolio's volatility simply due to the smaller bet size.

Also, the quest to reduce volatility at all costs might not be the best route for a trader. Volatility should be sought since **E**[PT] = **E**[ Δipi / pi] = **E**_{avg}[r_{i}]. This leads to the notion of an average return on the bets made since each bet was initially designed to be the same, a fixed fraction of equity (0.25% ∙ F(t)). Therefore, what should be maximized is: max **E**_{avg}[r_{i}].

One of the easiest ways of doing this, with little effort, is to give your trades more time in order to give them more time to appreciate.

As Jesse Livermore once said: “*It was never my thinking that made the big money for me. It was always my sitting.*” Turns out it was pretty good advice since there will be a lot of sitting going forward.

Sept. 10, 2020, © Guy R. Fleury. All rights reserved.