Skip to content
All library documents

Deep Momentum Networks Trained and Selected by Sharpe Ratio

Code Stratmill research code

Summary

This code describes a deep learning approach for turning sequential market features into position signals. Its example model uses an LSTM layer followed by dropout and a time-distributed output constrained through a hyperbolic tangent activation. Training minimizes a negative Sharpe-style objective based on positions multiplied by realized returns, with annualization based on 252 periods.

Model selection can use ordinary validation loss or a custom validation Sharpe measure. The custom callback aggregates position-weighted returns by time, saves the best weights, and stops training when validation Sharpe stops improving. Random search tunes model and minibatch settings, and the code includes a diversified evaluation path that averages trial metrics across repeated executions. This is an implementation sketch, not a complete empirical report: the excerpt omits substantial context, including the feature construction and data details, and provides no results. It does not establish that the approach generalizes or address costs, turnover, or leakage controls.

Key ideas

  • The example uses an LSTM to map sequential features to bounded position outputs.
  • Training optimizes a negative Sharpe-style return objective.
  • Validation can select checkpoints using Sharpe aggregated across time periods.
  • Random search tunes model parameters and minibatch size, with repeated executions supported.
  • The excerpt provides no empirical performance or sufficient detail to assess generalization and trading costs.

Tags

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