Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

MLP Neural Network Class - library for MetaTrader 5

Views:
9933
Rating:
(47)
Published:
2011.12.02 12:42
Updated:
2016.11.22 07:32
\MQL5\Scripts\MLP\
class_netmlp.mqh (12.74 KB) view
testmlps.mq5 (4.67 KB) view
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

CNetMLP provides multilayer perceptron (MLP).

The feature of the class is that input vector and network structure notions are separated, i.e. input vector and network structure descriptions are not connected to each other.

The size of the input vector can have any value within reasonable limits. Input data should be normalized, i.e. the data should be within the range -1 .. 1 or 0 .. 1. Various activation functions are applied for the network depending on the type of the used data: hyperbolic tangent should be used for -1..1 data range, while sigmoid is used for 0..1 data range.

The network has a layer-by-layer structure with a direct signal transmission. The network structure is described by a one-dimensional array, where the value of the array element determines the number of neurons in the appropriate layer. The number of layers and neurons is not limited. The network may consist of a single neuron.

Each neuron has multiple inputs, defined by its place in the network, and one output. If you need the network to give out N responses, the last layer should contain N neurons. The learning algorithm is iRprop. Input and output training data are located in one-dimensional arrays vector by vector. The learning process is limited either by the number of learnnig epochs or by a permissible error.

Creation of the network is declared to be the class parametric constructor.

CNetMLP  *net=new CNetMLP(

the number of layers, network structure array, input vector size, activation function type: 0 - sigmoid, 1 - hyperbolic tangent).

Network teaching is provided by calling the Learn method (the number of teaching patterns, input data array, output data array, the number of learning cycles, permissible learning error). Teaching result can be checked through the class variables: mse – the learning error and epoch – the number of accomplished learning cycles.

Calculate method (input vector array, network response array) is used for getting the network response.

Save (open the file handle with FILE_WRITE and FILE_BIN flags) and Load (open the file handle with FILE_READ and FILE_BIN flags) methods are intended for saving the network to a file and loading the network from the file respectively. Only learning errors and the weight array are saved to the file. Compliance of the created and the downloaded networks must be verified before the Load method (handle) is used.

Using of the class is shown in the attached specimen. The class and the specimen files must be placed in one folder.

Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/596

WPRSI signal WPRSI signal

The indicator gives trading signals using colored arrows on a chart. The signals are based on the WPR (Williams’ Percent Range) and RSI (Relative Strength Index) technical indicators.

Leading Leading

The indicator consisting of two moving averages (Lead and its EMA smoothing) on one chart from John Ehlers' book "Cybernetic Analysis for Stocks and Futures: Cutting-Edge DSP Technology to Improve Your Trading".

EQUILIBRIUM-2011 EQUILIBRIUM-2011

Multicurrency "grider" with risk control (version for Automated Trading Championship 2011 and updated version).

Modified Optimum Elliptic Filter Modified Optimum Elliptic Filter

Modified elliptic filter from John Ehlers' book "Cybernetic Analysis for Stocks and Futures: Cutting-Edge DSP Technology to Improve Your Trading"