Libraries: LSTM Neural Network

 

LSTM Neural Network:

Long Short-Term Memory Neural Network - for time series analysis.

Author: Shephard Mukachi 

LSTM Neural Network
LSTM Neural Network
  • www.mql5.com
Attached are the include files for the LSTM. The files included are: Gates - for the 4 gates used in an LSTMs. TimeStep - which combines the gates, and in practical usage would represent the time series bars.LSTMNetwork - implementing the learning algorithms. Also included is an example LSTMTest...
 

I'm trying to load this in MT5, but I need some help. I've placed all the files in the correct folders. Also, I opened all files in MetaEditor and compiled. Everything compiles. So far, no problem.


However, when I drag the EA onto a chart, I get this in the journal:

2019.06.16 17:31:23.525 Scripts script LSTMTest (EURUSD,M1) loaded successfully

2019.06.16 17:31:23.564 Indicators custom indicator Simple RPC (EURUSD,M1) loaded succesfully

2019.06.16 17:31:23.805 Scripts script LSTMTest (EURUSD,M1) removed

2019.06.16 17:31:23.806 Indicators custom indicator Simple RPC (EURUSD,M1) removed


Note that the EA loads on the chart for a moment then immediately uploads.

 

I then tried using the EA in the strategy tester. After clicking "Start" I got this in the strategy tester journal:

2019.06.16 17:25:31.942 MQL5 wrong type, loading of LSTMTest failed

2019.06.16 17:25:31.942 Tester loading of C:\Users\Home\AppData\Roaming\MetaQuotes\Terminal\9EBAECC50A1974DB0763442DEE6D2442\MQL5\Experts\Examples\LSTMTest\LSTMTest.ex5 failed


Any idea what's going on?

 
Sid McFarland:

I'm trying to load this in MT5, but I need some help. I've placed all the files in the correct folders. Also, I opened all files in MetaEditor and compiled. Everything compiles. So far, no problem.


However, when I drag the EA onto a chart, I get this in the journal:

2019.06.16 17:31:23.525 Scripts script LSTMTest (EURUSD,M1) loaded successfully

2019.06.16 17:31:23.564 Indicators custom indicator Simple RPC (EURUSD,M1) loaded succesfully

2019.06.16 17:31:23.805 Scripts script LSTMTest (EURUSD,M1) removed

2019.06.16 17:31:23.806 Indicators custom indicator Simple RPC (EURUSD,M1) removed


Note that the EA loads on the chart for a moment then immediately uploads.

 

I then tried using the EA in the strategy tester. After clicking "Start" I got this in the strategy tester journal:

2019.06.16 17:25:31.942 MQL5 wrong type, loading of LSTMTest failed

2019.06.16 17:25:31.942 Tester loading of C:\Users\Home\AppData\Roaming\MetaQuotes\Terminal\9EBAECC50A1974DB0763442DEE6D2442\MQL5\Experts\Examples\LSTMTest\LSTMTest.ex5 failed


Any idea what's going on?

Hallo Sid,

My apologies for not replying sooner. I just noticed your comment a moment ago. Not sure why I did not receive any notifications, anyway, hope you are still interested.  So the LSTMTest is actually a Script and not an Expert Advisor.

Someone else has messaged me requesting if I could write an Expert Advisor demonstrating use of the LSTM. I'll embark on doing that in the next few days as I'm busy with another project at the moment - but promise as soon as I'm done, I will develop an EA, maybe a simple 2 MA strategy.

Thanks,

Shep

 
Shephard Mukachi:

Hallo Sid,

My apologies for not replying sooner. I just noticed your comment a moment ago. Not sure why I did not receive any notifications, anyway, hope you are still interested.  So the LSTMTest is actually a Script and not an Expert Advisor.

Someone else has messaged me requesting if I could write an Expert Advisor demonstrating use of the LSTM. I'll embark on doing that in the next few days as I'm busy with another project at the moment - but promise as soon as I'm done, I will develop an EA, maybe a simple 2 MA strategy.

Thanks,

Shep

I look forward to that Shep, this looks promising.

 
Hi everyone

Regarding the LSTMTest.mq5 test code supplied with this library. What formula would I have to use in order to convert output from : net.Calculate(in) to the actual prediction value? The output from the method that I get is something like 0.16 while he actual target value is something like 7.59.

Any help would be greatly appreciated :) 
 
SIDNEY EDWARD JR MCFARLAND #:

I'm trying to load this in MT5, but I need some help. I've placed all the files in the correct folders. Also, I opened all files in MetaEditor and compiled. Everything compiles. So far, no problem.


However, when I drag the EA onto a chart, I get this in the journal:

2019.06.16 17:31:23.525 Scripts script LSTMTest (EURUSD,M1) loaded successfully

2019.06.16 17:31:23.564 Indicators custom indicator Simple RPC (EURUSD,M1) loaded succesfully

2019.06.16 17:31:23.805 Scripts script LSTMTest (EURUSD,M1) removed

2019.06.16 17:31:23.806 Indicators custom indicator Simple RPC (EURUSD,M1) removed


Note that the EA loads on the chart for a moment then immediately uploads.

 

I then tried using the EA in the strategy tester. After clicking "Start" I got this in the strategy tester journal:

2019.06.16 17:25:31.942 MQL5 wrong type, loading of LSTMTest failed

2019.06.16 17:25:31.942 Tester loading of C:\Users\Home\AppData\Roaming\MetaQuotes\Terminal\9EBAECC50A1974DB0763442DEE6D2442\MQL5\Experts\Examples\LSTMTest\LSTMTest.ex5 failed


Any idea what's going on?

This is for the next person since this was obviously 3 years late!

Yes, you placed it in the "Examples" directory under Experts since we now know it is a script. I just took all the subdirectories out of a single "INCLUDE" line of code without issue. Like this:

#include <LSTMNetwork.mqh>

I did this from the LSTMTest.mq5 file, and it is the only file to edit, only 1 line to change

Then I put the include files in the Include folder (they were inside of 2 other subfolders previously and now none)

The I put the other files LSTMTest.mq5 and Simple RPC.mq5 files in "Scripts" since that is what it is, not under "Experts" directory.

Then I compiled the LSTMTest.mq5 file, and it was in my trading terminal ready for use.

After running it, I clicked the Experts tab for MSE, Epochs, and Out values.

 
checkmate1 #:

This is for the next person since this was obviously 3 years late!

Yes, you placed it in the "Examples" directory under Experts since we now know it is a script. I just took all the subdirectories out of a single "INCLUDE" line of code without issue. Like this:

#include <LSTMNetwork.mqh>

I did this from the LSTMTest.mq5 file, and it is the only file to edit, only 1 line to change

Then I put the include files in the Include folder (they were inside of 2 other subfolders previously and now none)

The I put the other files LSTMTest.mq5 and Simple RPC.mq5 files in "Scripts" since that is what it is, not under "Experts" directory.

Then I compiled the LSTMTest.mq5 file, and it was in my trading terminal ready for use.

After running it, I clicked the Experts tab for MSE, Epochs, and Out values.

Thanks for answering this question.  I've been awfully busy and have not had time to check the forum.  It was s simple example to how LSTM's at work and for those with the technical acumen, it's a good start to build their own. Thanks once again.  

Reason: