LSTM Neural Network - MetaTrader 5 Library | Forex Indicator Download - MT4/MT5 Resources
The attachment is the include file of LSTM. The files included are:
Also included is a sample LSTMTest script using Simple RPC metrics (also attached).
To create a new LSTM network, provide the constructor with the number of modes, the number of inputs (predictors for each time step), and the number of time steps, as shown below;
CLSTM network*net= new LSTM network (mode, input, time step);To train the network, call the Learn function, providing it with the input array, target array, learning error threshold, and number of learning epochs, as shown below;
net.Learn(in,tg,mse, 500,000 );After learning is completed, the final error and convergence period can be obtained from the network, as shown below;
net.MSE(); net.Epochs();
To check for a specific pattern against the network, call the compute function, passing the candidate patterns as arguments to the function, as shown;
net.calc(in);
The calculation function returns the output. This LSTM has one output neuron.
If anyone finds bugs or has improvements or any suggestions please share. Good luck.
Attachment download
📎 gates.mqh (4.3 KB)
📎 timestep.mqh (3.79 KB)
📎 lstmnetwork.mqh (11.24 KB)
📎 lstmtest.mq5 (3.14 KB)
📎 simple_rpc.mq5 (9.92 KB)
Source: MQL5 #24200
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •