Skip to content
All library documents

Selective State Space Models for Trading Time-Series Forecasting

Article MQL5 articles

Summary

The article introduces Mamba, a selective state space model proposed as an alternative to Transformer-based sequence modeling. It explains the motivation: attention has costs that grow with context length, while ordinary recurrent or convolutional models can struggle to identify which parts of a sequence matter. Mamba makes selected state-space parameters depend on the input, allowing the model to retain relevant information and filter out distracting history. The article also describes implementation ideas for efficient computation, including kernel fusion, parallel scanning, and recomputation to limit memory use.

The practical section outlines an MQL5 implementation of a simplified selective state space layer and its use in a larger neural forecasting system. The reported trading results are mixed: average losses exceed average gains, maximum loss is larger than maximum profit, and drawdown exceeds 35%. The article also notes differing outcomes by weekday and time of day, which it treats as grounds for further analysis. These results do not establish that the model is profitable; the implementation differs from the original method and is explicitly presented as needing refinement.

Key ideas

  • Selective state space models make sequence interactions depend on input data.
  • The selection mechanism is intended to retain relevant context and discard irrelevant inputs.
  • Mamba aims for efficient sequence processing with linear scaling in sequence length.
  • The article implements a simplified state space layer in an MQL5 neural network.
  • Reported trading results are mixed and include substantial drawdown, so they do not establish a successful strategy.

Tags

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