Hey Guys!

I wrote a momentum strategy which trades the top 1000 liquid stocks. The strategy was inspired by ideas presented in the book Quantitative Momentum: A Practitioner's Guide to Building a Momentum-Based Stock Selection System by Jack R. Vogel and Wesley R. Gray.

There are two main ideas from Vogel and Gray which this strategy is built on.

1. Short term momentum over a 1-month lookback period tends to experience reversal over the next month.

2. Long term momentum over a 12-month lookback period tends to persist over the next month. In addition, "continuous" momentum tends to persist more often than "discontinuous" momentum. Momentum is "continuous" over a lookback period if the returns curve is smooth rather than volatile.

Calculating Long Term Momentum

The long term momentum is defined as the 12 month compounded monthly returns over a 13-month lookback period, skipping the latest month.The latest month is skipped in our long term momentum calculation to account for the short term momentum reversal effect.

This is calculated by the AnnualizedReturns method.

Calculating the Continuity of Past Returns

Vogel and Gray define continuity of returns as

ID = sign(Past Return) ∗ [% negative − % positive]
% negative is the number of losing days
% positive is the number of winning days

The idea is that a winning stock has continuous momentum if it is composed of many small winning days rather than a few big wins with many small losses. For a winning stock, If % positive > % negative , this means the large scale win is composed of many small daily wins, and vice versa for losing stocks.

This is calculated by the Continuity method.

Calculating Short Term Momentum

The short term momentum is defined with the ADX indicator over a lookback period of 20 days, which is approximately the average number of trading days per month. RecentDownTrend and RecentUpTrend determine if a stock has had strong downward or upward momentum within the past month.

We use the conventional ADX threshold of 25 to determine if a trend is strong.

Creating Insights

From our universe of 1000 liquid stocks, we take the top 100 winners and top 100 losers by annualized return.Next, we sort our winners and losers by their continuity of returns. Then, from our long term winners, we choose ones with recent strong downward reversals, and do vice versa for long term losers.

Once a week, we create upward insights for the top 5 most continuous long term winners that are recent losers, and downward insights for the top 5 most continuous long term losers that are recent winners.

The hope is that the long term trend will persist and the short term reversal is a "Fakeout".

There is room for improvement in the algorithm, particularly in insight creation and parameter reduction. I encourage you to take a look and see if you can make it your own.