Examples: FANN2MQL Neural Network Tutorial - page 2

 
albert:

Julien, you've done a serious work. I tried to use this indicator and I stumbled over several problems. I'll be much obliged to you if make some clarifications.

After successfully installing Fann2MQL Library, I ran the indicator and it resulted in the same output as yours, from where we can deduct that for UP signal it should signal "1" and for DOWN it should signal "0". When I tried to read the Indicator Buffer through iCustom() function called from an EA it didn't read any of these choices. That was the first problem.

In my second attempt to get a feedback from the indicator or the library, I tried to call the function compute(inputVector) and receive back the result of a prediction via Global Variable like that:

void prepareData(string action, double a, double b, double c, double output) {
double inputVector[];
double outputVector[];
// we resize the arrays to the right size
ArrayResize(inputVector,f2M_get_num_input(ann));
ArrayResize(outputVector,f2M_get_num_output(ann));

inputVector[0] = a;
inputVector[1] = b;
inputVector[2] = c;
outputVector[0] = output;
if (action == "train") {
addTrainingData(inputVector,outputVector) }
if (action == "compute") {
GlobalVariableSet("Prediction",compute(inputVector));}


After that I received the result of the prediction by reading the same variable through an EA, but the result was invariably "0". So my question is how can I get a prediction result from the indicator if not from the IndicatorBuffer? Any idea will be blessed.

Thank you in advance for your attention.

Albert


This source is not meant to be used.

A neural network is only working if it has been trained. Usually, you train the network, you save the network ( f2M_save() ), then when you want to use the network with a real application, you load the network ( f2M_load() ) and send him the input data.

This example is training and using the network at once, without saving nor loading it. Also, the basic patterns I defined here are random, not related to any financial pattern.

As a result, you won't be able to use this source to predict any financial data.


If you want to use a ANN to recognize patterns you need:

1) define the patterns

2) teach the patterns

3) save the neural network

4) load the pattern on another indicator

5) send input data

6) get your prediction


What do you want to forecast? What kind of pattern?

 
Hi Julien,

Thanks for clearing the stuff.
My question is: has anyone seen any really working NN implementation in any trading software? My experience shows they're not better than moving average crossover....
 

Ya Julien, I haven't seen any NN implemented successfully yet.

Best Forex Robot


Forex Robot

 

It's very good, thanks Julien. Btw for currency prediciton using neural network, do you have any experience what usually used as inputs and target?

 

http://pixiefx.web.fc2.com/index.html

http://www.ustream.tv/channel/fx-on-com-perrier

This is a great trading system.

 
Hello, I had 2 quick questions I was hoping you could clarify on your code. I am slightly familiar with NN. I was wondering if you could explain how you decided to use 2 hidden layers and why you chose 8 and 5 neurones for each layer. Is there a rule of thumb based on inputs/outputs you use. Also, I saw you wrote this as an indicator, could it be adapted and run as an expert and still print the same results in the print log. Thanks, Chris
 

hallo julien .

about the example :

how do you select the hidden layers = 8 and hidden layers2 = 5 ?

it is because of 2 power 3 ? this is all the data space ?

second question : do you have to write the comute() and teach() ?

do we have a standart library with template in order to use it without writing the algoritm ?

or we can choise in the library to add or inprove a template function in order to teach the system better ?

 

hey, i've got a problem, when i change the number of output, it doesn't work.
Even if i change the structure of the preparData function, the output number still 1
Can someone help me please ?

 

Hallo,

is it possible to get 2 and 3 as output for 0 and 1?

When I train it, everything seems to be OK.

But when I compute it, the output every time returns 1.

EURUSD,M15: Computing() ==> 1.00000000

EURUSD,M15: Computing() ==> 1.00000000 2011.12.08 08:34:41 ASNN 1 learner(1) EURUSD,M15: 45,2,89 = DOWN UP = UP. Should output 2. ==>

EURUSD,M15: Computing() ==> 1.00000000

EURUSD,M15: Computing() ==> 1.00000000 2011.12.08 08:34:41 ASNN 1 learner(1) EURUSD,M15: 3,2,1 = DOWN DOWN = DOWN. Should output 3. ==>

 

Thank you very much for creating and delivering FANN2MQL package, could you please add more detailed descriptions for it's subroutines, maybe in a reference manual?

for example, I have some questions about the usage of subroutine

int f2M_create_standard(int num_layers, int l1num, int l2num, int l3num, int l4num);

to create an ANN:

1. How many layers can be created? maximum 3 hidden layers, or can be arbitrary?

2. In the opposite direction, I tried to create a simple ANN with only 1 hidden layer with f2m_create_standard(3, 10, 100, 1); but it refuse to eat saying an error "wrong parameter count". What was my mistake? or it does not support single hidden layer at all?