Skip to content
All library documents

Preparing Volatility-Scaled Momentum and Changepoint Features

Code Stratmill research code

Summary

This data-preparation module builds time-series inputs for a deep-learning momentum model. It reads close prices, clips extreme values using an exponentially weighted mean and standard deviation, then derives daily returns and volatility. The target is a volatility-scaled return shifted forward one day; additional features normalize returns across several lookback horizons and calculate MACD signals with three short/long window pairs. Calendar fields are also added, and rows with missing values are dropped.

A separate workflow reads changepoint detection outputs for multiple assets, forward-fills missing observations, computes normalized changepoint location from the lookback length, and joins location and severity to the model features by ticker and date. The code describes feature construction only; it supplies no model, trading rules, or empirical results. Its preprocessing choices and date alignment should be checked for the intended data, especially because forward-filling changepoint results carries prior detections forward and the target is shifted to a future day.

Key ideas

  • Extreme price observations are clipped using an exponentially weighted mean and standard deviation.
  • The module creates volatility-scaled returns as a next-day target and normalized returns at multiple horizons.
  • MACD signals and calendar fields provide additional momentum-model inputs.
  • Changepoint location and severity are forward-filled and joined to features by asset and date.
  • The code specifies data preparation, not model performance or a complete trading strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.