Sept. 23, 2020
The following was posted in a Quantopian Forum Sept. 22nd, expressing my point of view on the highlighted stock trading strategy. The strategy can be freely cloned, modified, and executed at will on their website. (Sorry for the links, Quantopian community website has shut down)
Some added notions to my previous article where I said I questioned every assumption in the original version of this program, even if I used Dan Whitnable's version as a starting point.
One of those assumptions was the fixed and generalized trend declaration which can have a major impact on trade dynamics.
When the program declares the trend as up, it becomes evident what the program should do next. It is relatively simple to declare something that will be seen as a trend up or down for a strategy.
The trading logic and methods used should be consistent with the trend definition used. It is not what the market is necessarily saying, it is us, as strategy designers, making that declaration. It is based on our understanding of the game we want to play or based on the simple assumption that we might need some kind of trend definition, if at all. Whatever is used, our programs will have to live with it, and indirectly, with our parameter choices, our own generalized market structure assumptions, whether they be right or wrong.
In this case, an uptrend was originally defined as the SPY's 50-day SMA being above its 200-day SMA. Nobody seems to have questioned the validity of using that particular SMA crossover trend-following definition. I understand. It is an easy solution and has been around for decades as if part of some market folklore. But shouldn't we dig further than that? Shouldn't we first demonstrate that it is indeed part of the best trend definitions out there?
If you applied, for example, the above trend definition over the last year (and in many other flat or volatile periods), you might have noticed that its overall timing was not that great. For instance, during the course of the recent pandemic, one could say: it was rather late to the party. And as such, that “trend definition” would have turned out to be quite expensive. The following chart illustrates this point.
The SMA negative crossover declaring the trend as down happened after the recovery was already underway, and the positive SMA crossover occurred 3.5 months after the low.
The strategy would have lost on the major part of the decline and then would have lost again on a big chunk of the recovery.
Early on, when modifying this program, I changed the trend definition to something more responsive to price variations. It served the strategy well as time progressed, especially in the subsequent walk-forwards (see from last January's simulations onward, for instance).
This turned out to be a worthwhile move since, during the pandemic, the portfolio surged upward more than initially expected. As said before, the program was transformed to seek volatility and the pandemic did provide it. The program had no knowledge of what a pandemic was, nor did it see it coming. But with a more sensitive trend definition, it handled the added volatility just as it had during the financial crisis.
You define a trend as part of a portfolio's protective measures. If the uptrend breaks down, the first intent is to get out of harm's way. In my version of the program, the portfolio went short, according to its own trend definition, instead of going to cash or bonds.
Nevertheless, the strategy was still operating mostly on market noise. It is just that there was a lot of noise at times. And being more sensitive to its trend definition, the program easily switched from long to short even if there were more false positives that also had a cost. It turned out quite well, as illustrated in the 6 successive walk-forwards presented.
A trend definition dictates what your trading strategy should do while it is defined as up or down. It is a binary choice. If it is ill-defined, not sensitive enough, or suffers from too much lag, as in the original program version, your portfolio will definitely pay the price. But, as said many times before, it is your choice, you decide what is best for you.
Sept. 23, 2020, © Guy R. Fleury. All rights reserved.