Examples: Using Neural Networks In MetaTrader - page 3

To add comments, please log in or register
Mariusz Woloszyn
66
Mariusz Woloszyn  

MadCow wrote:


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.

This is interesting. I never thought about memory axons but there definitely is a potential in this approach that is worth further exploration :)

Frankly I have no better idea for incorporation of Laguerrenet net in FANN. Probably you might ask on the FANN forum.

Mariusz Woloszyn
66
Mariusz Woloszyn  

skyhr wrote:

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

FANN is not a type of a network. It's a software that implements simple multilayer networks on C.

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?

AFAIK it's not possible in MQL4. It's one of two the biggest limitations of MQL4 (the other is lack of structure types) IMHO.

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?

What I meant was that i optimized certain parameters using MT4 built in genetic optimization.

Mariusz Woloszyn
66
Mariusz Woloszyn  

And yes: you can have any number of net outputs in FANN but you should really know what you are doing with the network!

MQL4 Comments
16316
MQL4 Comments  
emsi:
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.
if you go H E R E you can download Steffen Niessen Thesis and there you have it all about FANN. what you should know is that there are some learning algorithms like cascade2 algorithm or Q-SARSA where you have to define just the input layer and the out put layer, the hidden layers will be construct by the learning algorithm it self tghough reinforcement learning.
Mariusz Woloszyn
66
Mariusz Woloszyn  
kerosen:
emsi wrote: 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.
if you go H E R E you can download Steffen Niessen Thesis and there you have it all about FANN. what you should know is that there are some learning algorithms like cascade2 algorithm or Q-SARSA where you have to define just the input layer and the out put layer, the hidden layers will be construct by the learning algorithm it self tghough reinforcement learning.

Yeah, I read his Thesis a couple of time. It's an excellent source of information about RL and NN.

You're right that there are algorithms like cascade2 that can procude a network with "optimum" number of connections. However those are not much more than educated guess and cannot be used in all circumstances. For example you need a large set of input data and a known output values. In some applications neither is true.

MQL4 Comments
16316
MQL4 Comments  

emsi wrote:

Yeah, I read his Thesis a couple of time. It's an excellent source of information about RL and NN.

You're right that there are algorithms like cascade2 that can procude a network with "optimum" number of connections. However those are not much more than educated guess and cannot be used in all circumstances. For example you need a large set of input data and a known output values. In some applications neither is true.

regarding this data issue, here you have a lot of data... but as you said before for those who believe in AI over the capital markets, are a few things that they should know: what you want to do, what kind of inputs you want to use, getting crystal clear data and so on.

regarding cascade2 imho is a solution because we do have a dynamic market with dynamic rules. most of the white papers I have read(and believe me I did read hundreds of it) most of the researchers model the problem(forecasting forex) like a bi dimensional problem which is not at all and it is a multi dimensional problem. where my opinion is: "Understanding the PAST and watch the PRESENT, we can look into the FUTURE" :) so what I try to say is that first using data mining and KDD(Knowladge Discovery in Database) techniques, we should minner the past and from there to extract the fatures(inputs) and just after this you might want to use the power of ANN. otherwise is like having a F1 engine put it into a Trabant car :)

MQL4 Comments
16316
MQL4 Comments  

Hi Emsi,


First of all thankyou for your excellent tutorial and work. I really liked your library. In the past I have also created similar libraires based on JNNS and NeuroSolutions. One of the library still exists on the Babypips website.

One reason i liked your library is that its possible for online training and testing from MT4. I would like to contribute to your project with additional functionality (Batch learning & Plotting MSE from MT4). If you need help or looking for contributors I am ready to join the team.


Currently I am using self developed library based on NeuroSolutions, but sooner or later I would like to use FAAN and your library.


Best Wishes,

Arun

Mariusz Woloszyn
66
Mariusz Woloszyn  
aroonraj:

Hi Emsi,


First of all thankyou for your excellent tutorial and work. I really liked your library. In the past I have also created similar libraires based on JNNS and NeuroSolutions. One of the library still exists on the Babypips website.

One reason i liked your library is that its possible for online training and testing from MT4. I would like to contribute to your project with additional functionality (Batch learning & Plotting MSE from MT4). If you need help or looking for contributors I am ready to join the team.


Currently I am using self developed library based on NeuroSolutions, but sooner or later I would like to use FAAN and your library.


Sure! I'd really appreciate your contributions, but please try to keep the coding style so the code remains consistent.

I'm aware of the fact that Fann2MQL lacks many features of FANN so any suggestions or contributions are more than welcome!


Best regards,


Mariusz

Forexator
69
Forexator  

Hi.


How to modify this EA in order to work it toghether with MACD and another indicator, in example MACD+MA ?


In example, modify it to work not only with MACD but also with MA, something in example like this :


When MA 's value of last bar is more than MA last bar -1 (shift back 1 bar) it is a BUY signal,

in example BAR 0 : MA(40) 1.4000; BAR -1 : MA(40) 1.3980 --> Buy signal


when MA's value of the last bar is less than MA last bar -1 (shift back 1 bar) it is a SELL signal,

in example BAR 0 : MA(40) 1.3727; BAR -1 : MA(40) 1.3735 --> Sell signal


MA in example 40 period, close price, exponential.


What to add/modify in the original code of this EA in order to have

both MACD + MA signals before launch the order?


In example, launching a BUY order only when MACD get buy signal AND when MA get also BUY signal.


I hope to be clear.


Thanks for insights in advance.

Arnab Karmakar
134
Arnab Karmakar  

I tried to test the attached EAs. I tested the EA for the period 1.1.2007 to 1.1.2009. First I ran the EA with SaveAnn=true and NeuroFilter=false and then I ran the EA with SaveAnn=false and NeuroFilter=true. I got the same result. Am I doing anything wrong?


Thanks

Arnab

To add comments, please log in or register