Neural Networks - page 7

 
Cyclesurfer:
Awsome New Digital! Ill look at the material in a few minutes...gotta break out the russian..which isnt so great, but I think that coupled with AltaVista ill be able to make a decent attempt. Im currently coding in CORTEX on other Neural Networks (NN from now on) and im planning to convert into MQ4...I think we should DEFINATLY keep this thread going because (and this is an opinion) NN are THE future of tecnical anaylsis. NN's, for those who arent geek enough to know..are basically algorythms that mimic the brain (not nessisarily the human brain..cuz that would be Mind bustingly complicated) in that it learns as it goes. Im writing the EAs to give advice on whether or not to take a particular signal based on small patterns that have come before when a similer signal was given. Thats what most NN's do, they search data for small patterns that would be meaningless to us, or even other algorthms and see what those patterns do over time. The first EA will feature Brain Trend. I ask that everyone be patient though, CORTEX coding takes time...rather, it takes time to train the NNs and perfect them. If anyone here is familier with CORTEX or Code conversion, any help would be appreciated. I understand why russian forum would go commercial...NNs are the current style with big money traders. So...what do you guys say?

I moved you post to this thread where you will find few persons concerning this software. One of them is quoted above.

 

Neural Network using Matlab and Metatrader

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, 1 output. The hidden layer activation function is tansigmoide, for the output it is linear.

If I plot the NN output with the real price, it shows the NN is working, but with the code I did, it's definitely not working.

The calculated weights of 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);

<<

Thanks for your Help!

 

Here's an example to illustrate my problem constructing a neural network under Matlab. The picture I posted illustrate the target value (X) and the Neural network output (Y) for EURGBP. So at worse, for a real price of 0.7, the NN output is between 0.68 and 0.73 (pretty bad but it was just a test!).

If I use the NN weights to calculate the output value by hand, I get a 0.75, wich is impossible for 0.7... So I must be wrong somewhere in the calculation of my output... Here's the formula :

-1.1261*tansig(-1.6589*0.6964+1.4776*0.6936+4.5965)

-0.013796*tansig(-2.6065*0.6964+ 4.3402 *0.6936+0.30321)

+1.2166*tansig( 0.88612*0.69669364+0.11309 *0.6936+0.055821)+1.1116

The weights :

-Weights to layer from input

[-1.6589 1.4776;

-2.6065 4.3402;

0.88612 0.11309]

-Weights to layer

[-1.1261 -0.013796 1.2166]

-Bias to layer 1

[4.5965;

0.30321;

0.055821]

-Bias to layer 2

[1.1116]

The 2 input price used to calculate the output are :

0.6964

0.6936

The Network is a 2 inputs/3 hidden/1 output with Tangente sigmoide activation for hidden and linear activation for the output.

THANKS!!

Files:
captureplot.jpg  23 kb
 

Besides that, the correct Tangente sigmoide activation function was wrong in my mql4 code. The correct function is : 2/(1+MathExp(-2* x ))-1

Cheers!

 

First results

this thread looks a bit dead, but I hope there is still people interested in Neural networks around! So please share your experience with NNets here!

I already tested a few combinations of factors to test the prediction power of neural nets.

As I read in different papers and posts, using previous High-Low-Open-Close seems totally unefficient. The NN is totally lost in the dark... The Fitting plot of real value versus NN output is horizontal (1st pic Open-Low-High-Close.jpg), meaning it can't predict anything at all. It is the same result as trying to find the loterie numbers with a NN I tried different inputs and output values, normalized or not, the result is the same.

So what's worse to look at?? It seems that technical indicators work way better. I tested a mix of classic indicators as inputs to predict the absolute price. The fitting plot is not the best but not bad(2nd pic - Technical factors inputs.jpg). I also think using absolute values is a very bad idea.

Using the Moving average slope to predict future slope gives interesting results to identify possible reversals (3rd pic MA Slope.jpg).

Another interesting way of research is too use a NN to evaluate good trading conditions. So I created a normalized score claculated from the current close and it's distance to future High and Lows. If the score is high, it means that in the next 4 periods, the distance between current close and future highs is high (Buy profits aheads) and distance to low is low (no significant drawdown). I had no sucess with this method for the moment.

Hope to have some comments and experience sharings very soon!

 

Congrats Webesa

THX Dear Webesa,

those are good resuls,

but 1 question : isn't it better to use larger NN (more inputs+ more layers+more neurons) to approximate better relationship between candles?

 

from neural net to dll

Hi,

does anyone have experience with integrating a dll that contains a trained neural network from Matlab or Neurosolutions into a mq4 script?

 
webesa:
this thread looks a bit dead, but I hope there is still people interested in Neural networks around! So please share your experience with NNets here!

I already tested a few combinations of factors to test the prediction power of neural nets.

As I read in different papers and posts, using previous High-Low-Open-Close seems totally unefficient. The NN is totally lost in the dark... The Fitting plot of real value versus NN output is horizontal (1st pic Open-Low-High-Close.jpg), meaning it can't predict anything at all. It is the same result as trying to find the loterie numbers with a NN

I tried different inputs and output values, normalized or not, the result is the same.

So what's worse to look at?? It seems that technical indicators work way better. I tested a mix of classic indicators as inputs to predict the absolute price. The fitting plot is not the best but not bad(2nd pic - Technical factors inputs.jpg). I also think using absolute values is a very bad idea.

Using the Moving average slope to predict future slope gives interesting results to identify possible reversals (3rd pic MA Slope.jpg).

Another interesting way of research is too use a NN to evaluate good trading conditions. So I created a normalized score claculated from the current close and it's distance to future High and Lows. If the score is high, it means that in the next 4 periods, the distance between current close and future highs is high (Buy profits aheads) and distance to low is low (no significant drawdown). I had no sucess with this method for the moment.

Hope to have some comments and experience sharings very soon!

What exactly were your inputs/outputs for the NN that utilized the moving averages?

 
 

I guess you're right that if you don't have to continuously retrain, you don't need the dll.

Would you like to share a template for that?

Reason: