April 5, 2017

A Quest for Stock Profits – Part I

Over the last two weeks, I did some new tests using another trading strategy found on Quantopian. I only started modifying this strategy after someone made modifications to another version of the original program. The first time I looked at the original, I classified it as a throwaway. It could not even generate a speck of alpha.

A lot of time and work with nothing to show for it profit wise. It ended not even beating the index over its 13-year trading interval. At least, it finished close to it which is a lot better than most. But, nonetheless, not enough.

 

 #1  Stocks on the Move – Original Version (Feb. 11, 2016)
The Original Version (February 11, 2016)

(click to enlarge)

Some six months after the release of this trading strategy, a forum member presented some modifications based on the same general theme. I liked those modifications, they were making the strategy behave differently, and showing some alpha. I made modifications of my own on this new iteration and posted it. 

 #2  SOTM – My First Modifications (August 29, 2016)
My First Modifications (August 29, 2016)

(click to enlarge) 

These modifications rose the CAGR (compounded annual growth rate) to 24.82%. This without changing the program's logic or procedures. The outcome was more interesting than the 11.46% of the original version. And, I left it at that.

Forum members kept on improving on the trading strategy. About two weeks ago, I opted to give it a second look. Successively "improved" versions of the program were being put out one after another. This series of articles is somewhat their story. I will not include all modifications, only what I see as relevant in that step by step process of raising a strategy's overall CAGR.

A Guiding Light

I often use the following equation to keep me on track as to what can impact a trading strategy:

A(t) = (1+L)∙k∙A(0)∙(1 + r + α - lc% - fc%)t

For sure, frictional costs (fc), commissions and slippage are a drag on performance, so are leveraging costs (lc). Both need to be addressed and accounted for.

Notice that the alpha (α), if any, is also compounded, and not just the return (r) which here is viewed as the market average. If a trading strategy does not generate alpha (or has it negative), it too will be a drag on performance. It certainly can not be considered a plus if negative.

One can multiply all these positives, or negatives, by scaling up a strategy (k), and leveraging it (L). The scaling is to answer the simple question: can this strategy handle more capital, or is it to break down under the pressure? Will it maintain its CAGR? It is a CAGR game after all. Scaling is fine, but it does not say from where you will get the added capital.

This is not asking: can we leverage the thing? It would not make any sense if there was no alpha.

It certainly would not have increased profits on the original version. On the contrary, it would have reduced its output further. The original version was not a leveraging candidate. Anybody doing it anyway would have had to pay for it.

Notice that with no alpha, or a negative alpha, you take out any motivation you may have to trade at all. Buying an index fund would be more productive and more desirable than underperforming the averages.

Stress Testing

I continued to modify the then latest modified version to stress test the strategy using a little leverage since there was now some alpha generation in the design. Also scaled up the stakes to $1M. This raised performance to a 28.17% CAGR including all trading expenses paid. This already represents interesting levels for any fund. Most of them, over the long term, still have their return (r) tend to market averages. (Side note: this was all chronicled live in the above cited Quantopian forum link, you even have some of the programs that did the job. You can copy them and modify them at will. Give about 30 seconds for the page to load). 

 #3  SOTM – Modified Version
Modified Version

 (click to enlarge) 

The alpha is easy to detect. It is expressed by the continuous widening spread between the blue and red lines on the above chart.

Another member of the forum made some nice modifications to the program making it behave differently again. The strategy continued to move further and further away from the original design making it quite a different program altogether. I wanted to explore what were its limits.

The real objective of the game is to squeeze out more alpha (more performance) even if it is more expensive to extract it. It is not about the expenses related to trading that is the main concern. It is about how much profit is left after all the expenses. It is like in any other business, you need, whatever the trading methods used, to be profitable. But it is not enough, you have to outperform the averages, otherwise, why bother?

It is completely understandable. There is no free lunch in the market. You want more, you will have to do more. And, that is to increase your risk to obtain the higher returns, or simply play better.

As long as the added alpha can pay for the added expenses and some, you can continue to grow. It remains a compounding game, even for a trader or a trading system.

I showed that one could use leverage, and also scale this modified program to higher performance levels.

My main question was: will this trading method respond to future stock prices in the same fashion? I knew if I upped the ante, I would be able to extract more.

I understood objections by forum members. Too much of this, not enough of that, don't forget this. Sure, we have to consider everything. But, it should not necessarily paralyze us.

We need to know what we can do once a trading strategy has achieved alpha generation. Do we accept it as is and do nothing more? Or, do we explore how far it can go even if there are some added costs?

For instance, in this program, if you change the rank_table_percentile, you changed the number of stocks that will be considered as selectable candidates (see chart #5). That criterion already selects a lot more candidates than it needs. Nonetheless, it will have an impact on the final outcome. If you take the top 50 of a 300, 400, or 700 list, will it really matter? Well, the answer is yes, it will. Even if the top 50 are still the top 50. Some might not be the same in the top 50 since you are increasing the possibility of other candidates to jump the list.

A Simple Trading Strategy

You have a very simple strategy here. It bets on the top market caps having the top CAGRs over the last 90 trading days. That's it. It amounts to a trend following strategy after an upside breakout. There is nothing original in that process. Variations of this are probably used by more than half of the visible strategies on Quantopian.

This is kind of a recurrent theme also on Quantopian. Many strategies start with the same premises. By this is meant: take the highest cap stocks, sort them out in some way and pick the top of the list. It is all good. You don't want to trade illiquid or penny stocks. You want that there be volume to get in and get out of a trade for whatever reason you may have.

Most importantly, it is the kind of principle that will apply that it be over past or future data. But then again, everybody seems to be doing the same thing or some slight variation thereof. How could they differentiate from others?

Here, I will borrow a chart from another strategy found on Quantopian which I analyzed last summer. See article: A Simple Stock Trading Strategy – Part III. My interest is in a slightly modified version of its idealized price movement chart. 

 #4  SOTM – Idealized Price Movement
Idealized Price Movement

 (click to enlarge)

Observe the short almost horizontal black lines which act as linear regressions over the price data. View the chart as if on a log scale to keep the lines straight, and the move to bonds as a move to cash. What this trading strategy does is quite similar to the Simple Momentum Rotation system the chart describes.

What has been changed are the methods of entry and exit of positions. Imagine the black line as a small boat floating on a price series, wave after wave. You want to be long only when it slants up, where you have some potential to make a profit. Be in a position when the 90-day CAGR is positive, and over a specified threshold. Nothing very complicated, you could do this by hand. That traveling little black line totally specifies your holding time.

Instead of using a universal exit policy, in this program, the exit is done on an individual basis by deselecting the stock if the upward slope goes below a minimum positive value.

In other words, the stock is sold if it stops rising. And that is your protection, you don't need any other. You have trading rules that allow you to be in a position only if the 90-day trend is up. Otherwise, you are not there. You do not participate during the downside, and therefore, you do not fear big market drawdowns simply because you will be in cash during those periods just as illustrated in chart #3 (see the exposure line).

This is all acceptable. The black line can have the advantage of reacting sooner to price change due to its 90-day evaluation period against the 252-days of the Simple Momentum Rotation system.

A Different Look

Here is my interpretation of this trading strategy using just a few lines: 

 #5  The Strategy's Filters
The Strategy's Filters

 (click to enlarge)

This trading strategy is not only a breakout system, it is a trend following system as well. The assumption being that the 90-day upward trend in the selected stocks might continue. There is no guarantee of it, but it is a reasonable assumption. Notwithstanding, if it was not, one could not extract any alpha.

Note that the original version of this strategy did just that: generate absolutely no alpha. Explicitly stating that there is none to be found, none to be had. Also, statistically stating that, on average, stocks did not have that much memory beyond their 90-day marker.

Yet, what we can see from the above picture appears reasonable. You are taking stocks that have shown to have positive returns over at least the past 90 trading days (4.2 months), and making the assumption that the upward trend might continue. And why not? At least, the stocks making the list have shown they have gone up over their recent past.

This is not an estimate. It is based on actual recorded data. And if you are not buying stocks that you expect to go up, then what will you buy? It can also be viewed as simple as that.

There are economic reasons behind the changes I made to certain parameters. They were guided toward increasing trading activity and expanding the average profit per trade, two basic portfolio metrics that I have discussed often in my recent articles.

 

Related Articles:

A Simple Stock Trading StrategyPart IPart II, and Part III.


Created... April 5,  2017 © Guy R. Fleury. All rights reserved.  

Alpha Project