For who knows what reason, percent price change has been designated “momentum” in financial jargon. Typically, momentum is used to measure trends and is then applied to trend following systems as an entry signal. We do the same here, trading a portfolio of stocks and only taking positions if momentum is positive.

The twist is to use dynamic time warping distances and k-medoids clustering to select a portfolio. Additionally, we compute four sets of weights, conservative using the T-bill ETF (BIL) as the cash component and aggressive which does not use cash and both equal weights and weights proportional to the reciprocal of the standard deviation.

Here are the steps:

  1. Set the following parameters: 100 formation days, fractional return paa representation with 10 pieces each of length 10 days, average volume for the formation days >= 100,000, 15 stocks in the portfolio.
  2. Transform the data into the fractional return paa representation, using dynamic time warping distances compute k-medoids clusters with 15 clusters in which the medoids are the stocks in the portfolio.
  3. Compute 1/formation days standard deviations.
  4. Conservative equal weights: weights = 1/15 if momentum > 0, else are set to 0.0, the residual weight (1.0 – sum of weights) is assigned to BIL.
  5. Conservative 1/standard deviation weights: sum 1/stdev for all 15 stocks, weights = (1/stdev)/sum, apply momentum as in step 4.
  6. Aggressive equal weights: weights = 1/# of stocks with positive momentum, else 0.0.
  7. Aggressive 1/standard deviation weights: same as step 5 but the sum is only for stocks with positive momentum, for non-positive momentum stocks, weights are set to 0.0.

Conservative Weights

NameEqual Weight1/Standard Deviation Weight
SMLRSemler Scientific0.06670.0373
TANHTantech0.06670.1942
ZEVLightning eMotors0.06670.0447
PXSPyxis Tankers0.00.0
VIEWView0.06670.0263
DDominion Energy0.00.0
HUDIHuadi International Group Co.0.06670.0647
BJDXBluejay Diagnostics0.06670.0362
OTMOOtonomo Technologies Ltd.0.06670.1491
LBCLuther Burbank0.06670.1404
UBERUber Technologies0.06670.0134
ROPRoper Technologies0.06670.004
HCTIHealthcare Triangle0.06670.0469
INVOInvo BioScience0.06670.091
BHGBright Health Group0.06670.013
BIL1-3 Month T-Bill ETF0.13330.1387

Aggressive Weights

NameEqual Weight1/Standard Deviation Weight
SMLRSemler Scientific0.07690.0433
TANHTantech0.07690.2255
ZEVLightning eMotors0.07690.052
PXSPyxis Tankers0.00.0
VIEWView0.07690.0305
DDominion Energy0.00.0
HUDIHuadi International Group Co.0.07690.0752
BJDXBluejay Diagnostics0.07690.042
OTMOOtonomo Technologies Ltd.0.07690.1731
LBCLuther Burbank0.07690.163
UBERUber Technologies0.07690.0155
ROPRoper Technologies0.07690.0046
HCTIHealthcare Triangle0.07690.0544
INVOInvo BioScience0.07690.1056
BHGBright Health Group0.07690.0151

Clustering serves the desire to create a diversified portfolio. Rather than making assumptions based on economic sector, industry, etc. we use distance to measure (dis)similarity which is then fed into a cluster algorithm to yield a portfolio of stocks that are not moving in lock step. Additionally, clustering with momentum also provides a snap shot of the state of the market and the ability to express conservative and aggressive views.

If you find such information useful, we ask that you provide value in return via the Value 4 Value links on theĀ homepage. We would also appreciate you spreading the word about our work.