Neural Network trading using Matlab and Metatrader
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 :
The weights from the hidden to the output are :
[0.0020021 0.0047956 -3.4143]
Bias of the hidden layer :
Bias of the output
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 Sum_node_1_1=13.8525*a1 -43.4534*a2+13.876;
//---- Exit value -----
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!
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!
matlab with metatrader
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?
I'm interested too in your results. subscribing.
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:
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
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.
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.
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.
© Forex Factory