Skip to content
All library documents

Building a Single-Layer CNN Trading Signal in MQL5

Article MQL5 articles

Summary

This article adapts a single-layer convolutional neural network (CNN) for a trading signal in MQL5. It explains padding input matrices, convolving kernels across data, applying activation, and pooling feature maps; it also discusses backpropagation for training. Rather than image pixels, the example uses indicator values based on close-price gaps from moving averages. The network is integrated into a custom wizard signal class and tested through an Expert Advisor.

The article reports a test on EURJPY daily data for 2023, with signal conditions based on whether the network output falls above or below 0.5. It notes that outputs are not normalized, so the long and short conditions are coarse binary decisions; normalization could allow more adjustable thresholds. The implementation is intentionally a single layer, leaving deeper architectures, alternative inputs, and target definitions unexplored. The reported test is an implementation example, not sufficient evidence of a durable trading edge, and the article does not establish performance beyond its stated test setup.

Key ideas

  • A CNN applies small weight kernels across matrix inputs to produce feature maps.
  • Padding can preserve feature-map dimensions, while convolution without padding reduces them.
  • The example uses moving-average-based price-gap values as input rather than image data.
  • The MQL5 implementation combines convolution, activation, pooling, and training through backpropagation.
  • Its EURJPY daily test uses a 0.5 output threshold, and the author notes that unnormalized outputs limit threshold sensitivity.

Tags

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