Skip to content
All library documents

Dual-Attention Trend Prediction with CNN and Piecewise Linear Features

Article MQL5 articles

Summary

The article describes a stock trend prediction model that combines short-term market features with longer-term temporal structure. A convolutional neural network extracts local relationships among market variables, while piecewise linear regression segments historical prices into intervals summarized by slope and duration. An encoder-decoder built from LSTM blocks uses attention in both stages to select relevant short-term features and connect them with long-term features when predicting trend direction and duration.

The discussion explains how segmentation thresholds affect the number of intervals and how convolution and pooling form compact feature representations. The article also presents an MQL5 implementation and reports that its model generated profits on data outside its training set, with a test-period profit factor of 1.12. Yet the balance chart contains a substantial drawdown, and the author says the results are not sufficiently consistent. The implementation is an interpretation of the proposed research method, so the reported outcome does not establish robustness, generalizability, or live trading performance.

Key ideas

  • The model combines CNN-derived short-term market features with long-term segments extracted by piecewise linear regression.
  • Dual attention in an LSTM encoder-decoder selects relevant inputs at both feature encoding and trend decoding stages.
  • The segmentation error threshold controls how many price subsequences are retained and how much fluctuation is smoothed away.
  • The implementation reported out-of-sample profits but also a substantial drawdown, leaving consistency unresolved.
  • The reported test result does not demonstrate robustness or live trading effectiveness.

Tags

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