Skip to content
All library documents

Implementing a Deep Neural Network Classifier in MQL

Article MQL5 articles

Summary

This article walks through a feed-forward neural network in MQL, from the weighted sums and biases of individual neurons to a network with two hidden layers. It uses hyperbolic tangent activations in the hidden layers and softmax outputs for three trading states: buy, sell, and hold. The network’s weights and biases are set through strategy tester optimization rather than updated by a training algorithm implemented in the code. The article also describes using the output probabilities to open, reverse, or close positions.

For optimization, the author searches parameter values over stated ranges and evaluates them in MetaTrader 5 using historical exchange-rate data, with open prices only because decisions rely on the last closed candle. The document mentions a backtest and claims improved predictive accuracy, but provides no usable performance figures or detailed baseline comparison in the supplied text. It does not establish out-of-sample robustness, and optimizing many weights against a limited history can produce overfitting. The approach is an implementation example, not evidence that the classifier will generalize across markets or periods.

Key ideas

  • The network computes weighted inputs through two hidden layers before producing class probabilities with softmax.
  • The hidden layers use hyperbolic tangent activations, while the output classes represent buy, sell, and hold.
  • The article uses strategy tester optimization to select weights and biases instead of implementing gradient-based training.
  • Historical backtest claims are not accompanied by detailed metrics or evidence of out-of-sample performance.

Tags

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