Skip to content
All library documents

Training a FANN Neural Network to Classify Three-Value Patterns

Article MQL5 articles

Summary

This tutorial demonstrates a basic feed-forward neural network using the FANN library through MQL. The example is deliberately independent of market data: it trains on triples of numbers and assigns a binary label according to whether the first and third movements point in matching directions. It configures input, hidden, and output layers, records labeled examples, repeatedly trains on them, and uses mean squared error as a stopping condition before querying the network with unseen triples.

The article explains how training examples are passed to the library and how the resulting output can be inspected. It offers a small illustrative demonstration, not evidence of trading performance or generalization on financial time series. The training set is limited to hand-picked examples, and the text gives no systematic validation, comparison, or discussion of scaling inputs, overfitting, or model selection. Its value is mainly as an introductory implementation pattern for connecting a neural network library to MQL.

Key ideas

  • The example maps three numeric inputs to a binary pattern label based on their relative ordering.
  • A feed-forward network is configured with input, hidden, and output layers through the FANN interface.
  • The network is trained repeatedly on labeled examples until its mean squared error meets a chosen threshold or a training limit is reached.
  • Unseen triples are then submitted to check whether the network learned the rule.
  • The demonstration uses synthetic examples and does not establish usefulness on market data.

Tags

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