Quantopian Lecture Series: Measuring Momentum

Measuring momentum is key for constructing effective momentum strategies. In this lecture we discuss a few common measures of momentum. A broader discussion of momentum based strategies is available here.

We will be releasing a video lecture as well, watch this thread for a link. Find all of our lectures hosted permanently with videos at www.quantopian.com/lectures.

1268
Notebook previews are currently unavailable.
Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

7 responses

After much delay, the video has been posted:

Delaney do read... those physics measurement below in your notes which ones indicate that its going upward or downward.. ? I have a friends who's a trader.. he just look at the ATR... indicator if its a low number there's no momentum is that a valid assessment..?

I don't know any particular indicators that well, so unfortunately I can't make any educated comments about ATR. The physics measurement systems in the notes are more experimental and would need some work to actually be used in a trading system. The important thing about momentum is that it has no direction, there can be momentum up or down. Once you establish that there is probably momentum using whatever model or indicator, then you'd also have to check for the direction of that momentum. The hypothesis in the example is that volume plays a role in momentum, so that's what the formulae are trying to capture.

how about... the hypothesis that volatility also plays a role... in momentum...? like the VIX... and applying it to individual stocks. the
VIX also have no direction but when it goes up market will sell..

Sure, testing a model in which VIX is factored into momentum sounds like an interesting experiment. The important thing is not to stick too hard to any one method of predicting/measuring momentum, as different methods may become more and less effective over time. Develop a hypothesis for what might impact momentum, then test it using the research environment and look at the error in your predictions.

This is the reason I don't pay close attention to any particular indicators. Their effectiveness will wax and wane over time, and I suspect that people only publish their indicators after they stop working. Being able to statistically test your hypotheses on the other hand will allow you to generate new models as you need them.

Hi All,

For anyones interest I have the original notebook to work with the changes accessing fundamental data via pipeline and a few depreciated functions
I am interested in making a factor for pipeline out of one of the factors that is included being the distance ranking function (extracted below), however I am struggling to get it working.

Any suggestions of how to put this into a custom factor

scores = pd.Series(index=asset.index)
for date in rolling_means.index:
mavg_values = rolling_means.loc[date]
ranking = stats.rankdata(mavg_values.values)
#print mavg_values.values.round(2)
#print ranking
d = distance.hamming(ranking, range(1, 11))
#print d
scores[date] = d

My attempt

class distance_rank(CustomFactor):
# this class generates the MACD as a Percentage
inputs = [USEP.close]
window_length = 90
def compute(self, today, assets, out, close):

    anynan = columnwise_anynan(close)

for col_ix, have_nans in enumerate(anynan):

if have_nans:
out[col_ix] = nan
continue
ema_3 = talib.EMA(close[:, col_ix], timeperiod=3)
ema_5 = talib.EMA(close[:, col_ix], timeperiod=5)
ema_7 = talib.EMA(close[:, col_ix], timeperiod=7)
ema_10 = talib.EMA(close[:, col_ix], timeperiod=10)
ema_15 = talib.EMA(close[:, col_ix], timeperiod=15)
ema_30 = talib.EMA(close[:, col_ix], timeperiod=30)
ema_40 = talib.EMA(close[:, col_ix], timeperiod=40)
ema_50 = talib.EMA(close[:, col_ix], timeperiod=50)
ema_60 = talib.EMA(close[:, col_ix], timeperiod=60)

df = np.array([ema_3[-1],ema_5[-1],ema_7[-1],ema_10[-1],ema_15[-1],ema_30[-1],ema_40[-1],ema_50[-1],ema_60[-1]])
#df = pd.Series([ema_3,ema_5,ema_7,ema_10,ema_15,ema_30,ema_40,ema_50,ema_60])
ranking_short = rankdata(df)
d = distance.hamming(ranking_short, range(1, 11))
#out[col_ix] = ema_3[-1]
#out[col_ix] = ranking_short[-1]
out[col_ix] = d[-1]

20