Examples: Using Neural Networks In MetaTrader - page 2

 

Also, can you give us any guidelines in choosing the hidden layer#, hidden neuron#, and training algorithm (besides experimenting) if possible?


Thanks

 
skyhr:
How will the new MQL5 affect the Fann to MQL and its functions and wrapping since (I believe) MQL5 will support class structures?

I will try to send you a comment on this.

I know nothing for sure about MQL5. Once it shows up we'll see however I expect at least one year or two before it will be fully adopted by brokers.
 
skyhr:

Also, can you give us any guidelines in choosing the hidden layer#, hidden neuron#, and training algorithm (besides experimenting) if possible?

Unfortunately there is no other way than guessing and experimenting to find those values. The number of hidden layers should rarely exceed 2 but that's the only thing known for sure.
 

Excellent article. It is somewhat along the lines of neural network that I have been working on. Previously I have incorporated PNN to enable it to self learn so there is no need to train it manually, but there are limitations. Self training for FANN is possible too and I hope this mq4 could further be developed...

'Self learning probabilistic neural network (PNN)'

 
Dhananjay:

Excellent article. It is somewhat along the lines of neural network that I have been working on. Previously I have incorporated PNN to enable it to self learn so there is no need to train it manually, but there are limitations. Self training for FANN is possible too and I hope this mq4 could further be developed...

'Self learning probabilistic neural network (PNN)'

Frankly speaking I've been experimenting with Reinforcement learning (Q-Learning and SARSA) to obtain auto-adapting system with no external parameters at all. This is somewhat similar but I have introduced a lot of improvements :)
 

Hello Emsi,


Thank you very much for this great article!
I tried implement your example (with some changes in logic of input + input into trainig is number of pips for lossing or winning trade) into my EA (which had poor results) and after implementig there is PF over 9 and drawdown less than 2%
Interesting is that no short position wasn't opened (tested from 2008/08 to 2009/05 on cable) and there was very bearish trend ... I must determine why this occur.
But I want ask you if you could provide some example how can be FANN used for forecasting of price movement (indicator for example). It will be very usefull.

Thank you very much!

 

This is very helpful, well documented, and an excellent explanation. Thank you.


There are other networks that are sometimes helpful when processing time series. One is a recurrent Laguerre net. Such a net does not require a tapped delay line of input vectors, since the Laguerre axon has memory. Perhaps one could simulate this as an input axon using equations like

L0[i] = alpha*input + (1 - alpha)*L0[i-1];
L1[i] = -(1 - alpha)*L0[i] + L0[i+1] + (1 - alpha)*L1[i+1];
L2[i] = -(1 - alpha)*L1[i] + L1[i+1] + (1 - alpha)*L2[i+1];
L3[i] = -(1 - alpha)*L2[i] + L2[i+1] + (1 - alpha)*L3[i+1];

Then the 4 outputs would depend upon the history of the single input. If each Ln[i] became an input to the ann, the number of inputs to the ann would be reduced, and training might be speedier. The value of alpha is usally a network variable to be learned, but that would require this axon to be integrated into the FANN, which is not likely. Instead, one might either guess at alpha, or try to optimize it, but the latter might be a very time-consuming process. If you have a suggestion of another method to incorporate such an axon into FANN, I would greatly appreciate hearing it.

 

But even so, won't the new EAs be written in MQL5 - will that matter if we just "insert" it onto the MT4 platforms? Or do EAs written in MQL5 must be loaded onto MT5 platforms?


Also, I have new questions (since your article is very insightful with good English):


1. What is the difference between FANN and other NN? (in terms of financial time series)


2. Silly question: but in your code init(), you have ArrayResize. This function only resizes 1 (the first, I think?) dimension of the array, but if we have a 2 dimension array, how do we resize the 2nd dimension?


3. In your explanation of the start() function, you mentioned you have a "genetic algorithm for optimization process". What do you mean by this - is this an optimizer that can search for robust parameters (that is, search for minima/maxima without sharp rises/falls). If so, could you kindly explain this as well?



Thanks a lot!

 

Followup:


Also, would I be correct in saying with any kind of NN, you can have multiple output values? Say 2,3?


Ah, finally, do you only use the Anfis Editor from Matlab? I'm sure there are plenty of other tools like Fuzzy Logic, though I'm not sure what the differences are.

 

"The number of hidden layers should rarely exceed 2 but that's the only thing known for sure."


Does this apply to FANN or other NN as well?

Reason: