• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 8:28am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 8:28am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

Neural Network Trading, Serious people only! 127 replies

Encog Neural Network Integration with Metatrader 5 EA Working Example 2 replies

Need help interfacing a Matlab DLL with Metatrader 5 replies

Interested in Neural Network Assisted Trading 4 replies

develop neural network in matlab 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 3
Attachments: Neural Network trading using Matlab and Metatrader
Exit Attachments

Neural Network trading using Matlab and Metatrader

  • Post #1
  • Quote
  • First Post: Jun 19, 2008 9:19pm Jun 19, 2008 9:19pm
  •  webesa
  • | Joined Jan 2007 | Status: Member | 6 Posts
Hello!

I am using Matlab and developped a neural network for several pairs, but I have issues reprogramming the NN from Matlab to mql4!

For a test, I created a small neural network predicting USDJPY price from price in i+10 and i+20. It has 2 inputs, 3 hidden neurons, 1 output. The hidden layer activation function in Matlab is tansigmoide, for the output it is linear.
If I plot the NN output with the real price, it shows the NN has predictive power, but with the code I did, it's definitely not working.

The calculated weights of the hidden layer are :
[13.8525 -43.4534;
-11.2084 18.4331;
-0.30603 0.01022]

The weights from the hidden to the output are :
[0.0020021 0.0047956 -3.4143]

Bias of the hidden layer :
[13.876;
2.644;
0.083215]

Bias of the output
[0.27514]

The problem must be in the activation function wich should be tan sigmoide. As the price is more than 100, the MathExp(-100) give me something very small...
Here is the interesting part of the code :

>>
double a1=iClose("USDJPY",0,i+10);
double a2=iClose("USDJPY",0,i+20);


//Node (1,1)
double Sum_node_1_1=13.8525*a1 -43.4534*a2+13.876;
double Sigmoide_node_1_1=(1-MathExp(-Sum_node_1_1))/(1+MathExp(-Sum_node_1_1));

//Node (1,2)
double Sum_node_1_2=-11.2084*a1+18.4331*a2+2.644;
double Sigmoide_node_1_2=(1-MathExp(-Sum_node_1_2))/(1+MathExp(-Sum_node_1_2));

//Node (1,3)
double Sum_node_1_3=-0.30603*a1+0.01022*a2+0.083215;
double Sigmoide_node_1_3=(1-MathExp(-Sum_node_1_3))/(1+MathExp(-Sum_node_1_3));

//---- Exit value -----
double Sum_node_2_1=(0.0020021*Sigmoide_node_1_1+0.0047956*Sigmoide_node_1_2-3.4143*Sigmoide_node_1_3+0.27514);


<<

I admit that the NN used non-normalized data (not the best), but the plot of the NN output vs the real value under Matlabd shows it is working, so I really wonder about the activation function...

Thanks for your Help!
  • Post #2
  • Quote
  • Feb 2, 2009 6:01pm Feb 2, 2009 6:01pm
  •  brenta929
  • | Joined Jun 2008 | Status: Member | 10 Posts
Are you still working with Matlab? How is your progress? I would be very interested in your results because we have developed a dll file that will connect Matlab and Metatrader. Not much luck with creating a good network in Matlab that isn't shifted.

Let me know!

Brent
  • Post #3
  • Quote
  • Jun 22, 2009 2:56pm Jun 22, 2009 2:56pm
  •  flairflair
  • | Joined May 2009 | Status: Member | 12 Posts
i m keen to know how your dll bridged matlab and metatrader. it seems highly possible to build a model in simulink to control metatrader operation or analysis in parallel with every tick. does your nn is real time running with the market or just used it to train a model to fit/optimise the result?

is there any suggestion or guide to learn the above interfacing among matlab,metatrader and dll altogether?

thanks
  • Post #4
  • Quote
  • Jul 16, 2009 7:30pm Jul 16, 2009 7:30pm
  •  yogert909
  • | Joined Dec 2008 | Status: Green pieces of paper | 2 Posts
I'm interested too in your results. subscribing.

thanks
  • Post #5
  • Quote
  • Jan 27, 2010 2:50pm Jan 27, 2010 2:50pm
  •  andrea182
  • | Joined Jan 2010 | Status: Member | 124 Posts
i've done something similar....

I would like to present to all of my work in order to create a group with which to develop the mine ea ....

is a job that took me a long time and I will share with the entire community in part because it is not solely and exclusively mine, but also a greek professor of mathematical analysis ...

My main idea was to move data and synchronize data with Matlab as many of you already know is a useful program in many mathematical functions already developed and very complex to develop mq4 ...

regarding the connection and the sincronizzazzione is already fully present in this guide:
http://articles.mql4.com/440

is explained in very understandable so there should be no problem ....

following the poster is and lets you read the results calculated from matlab ..

I remind you to write a file to buy 8 and 9 for sell ...

through these 2 lines you can write data into the correct folder where you can read mt4

% [Pathstr, name, ext, versn] = fileparts (fullname);% divides the full name
%% Of the file into parts
NewName =% [pathstr '' name '_result' ext];% re-compose the new file name


posters when I can also code for matlab without the primary function, but that which calculates the best sl and tp be set ....

to function as said in another post can give me from 75 to 80% prediction of where it will head towards the price will be delivered only to those who will actively participate in the development ...

calculator.rar = set of matlab functions matlab
MATLAB_EA_TP & SL2 is obviously the ea ....

for the indicator that is used in the guide should not have changed anything in that ...

if you want to traslate my function into mq4 or improve the code my email and msn account is abbaveto89[@]hotmail[.]it
Attached Files
File Type: mq4 MATLAB_EA_TP&SL2.mq4   12 KB | 1,405 download
File Type: zip matlab_calculator.zip   49 KB | 1,515 download
  • Post #6
  • Quote
  • Mar 5, 2010 12:36pm Mar 5, 2010 12:36pm
  •  Ipndasno
  • | Joined Feb 2010 | Status: Member | 593 Posts
Thanks for sharing this info. I have been wanting to do this for some time. I have contacted you by email as well.. I hope to work and share info on this project.
  • Post #7
  • Quote
  • Apr 16, 2010 10:42am Apr 16, 2010 10:42am
  •  Bwana
  • | Joined May 2009 | Status: Pip Pip Hooray! | 132 Posts
Hi, i used Matlab a lot in grad school.. can you explain to me please what _report3.txt / _report4.txt are and what you mean by "write" to file 8 and 9?

Thanks and looking forward to hearing from you.
Attached Image (click to enlarge)
Click to Enlarge

Name: Capture.jpg
Size: 156 KB
Time flies like an arrow; fruit flies like a banana.
  • Post #8
  • Quote
  • Jan 5, 2013 9:07pm Jan 5, 2013 9:07pm
  •  theroot
  • | Joined Jan 2013 | Status: Junior Member | 1 Post
Hello, have you tried DLL interface? It's described on http://articles.mql4.com/833 and it works great, you can pass any data array from metatrader as a matrix to matlab.
Inserted Video
  • Post #9
  • Quote
  • Last Post: Feb 27, 2013 11:39am Feb 27, 2013 11:39am
  •  RonaldLL
  • | Joined Feb 2013 | Status: Member | 2 Posts
Hello everybody.
I'm now also working with MT4 and have some function that I wrote in Matlab. Through the post http://articles.mql4.com/833, I also want to make a DLL-Wrapper via Borland C++ Builder, but I think some file (and step) are missing from the post. Can someone please tell me how to make a DLL file with Borland, and use it in MT4 successfully?
I hope someone have done this before. thankx.
  • Platform Tech
  • /
  • Neural Network trading using Matlab and Metatrader
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021