Better NN EA development - page 59

 

Hi Finimej,

I am also testing the PNN but i keep getting the following error in the expert log

PNN EURUSD, M1: zero Divide

it indicates that the library file PNN.mq4 is having issues with a certain division but i can't seem to find out what or where . Any suggestion

 

training/optimalization data

Hello everybody,

I followed this thread from the beginning and I miss some information.

Can you explain me what is an input data for training of NN in the EA ??

What sort of optimalization is being done for input paramaters of NN, and NN itself, how often etc.

Thanks, Krzysztof

 

Hi, progressapama,

I have not changed anything in the code at all. Download and compile and works. On the FXDD demo account.

Backtest, used the option "open price on each bar" to training the pnn traininger, with selected week period. then use the EA to use the week after the selected period, the result is so: PNN can doing will direct for the first 2 days after the training data, and start to less it's edge after 2 dags good winning ratio, for the days in the week.

Real time demo forwarding test.

1) traing PNN trainer with option "every tick in the bar" use the 3 days data (included current day), it takes whole night to finish it.

2) then put PNN trainer as EA on EURUSD M1 chart, and put EA on another chart of EURUSD M1.

Forwarding test result is : it can realy pick up the trade exakt at the turning point with very precision entries. Howerver, it's so frustrated that the EA only do buying trading. (Although it can do sell trade in the backtest, so it is not the codes fault). I put it "only Short", then the EA is not doing anytrade at all. An EA can do SELL as well, is very much appreciated when we have a financial crise, isn't ? hasn't check out the code yet.

 

See forwarding test PNN system on demo account, has changed any code.

It has realy nice entries on all the right points and does not take any trading when the EURUSD is congesting. It is also stupid enough only do buy operations!

Files:
pnn_1.gif  21 kb
 

Question to Barnix

fajst_k:
Hello everybody,

I followed this thread from the beginning and I miss some information.

Can you explain me what is an input data for training of NN in the EA ??

What sort of optimalization is being done for input paramaters of NN, and NN itself, how often etc.

Thanks, Krzysztof

Barnix, maybe you can answer me those question ??

Krzysztof

 
fajst_k:
Barnix, maybe you can answer me those question ?? Krzysztof

The input values you can find in indicator source:

https://c.mql5.com/forextsd/forum/55/attribind_2d.mq4

 

Error structure:

/* Struct: struct fann_error

Structure used to store error-related information, both

and can be casted to this type.

See also:

,

*/

struct fann_error

{

enum fann_errno_enumerrno_f;

FILE *error_log;

char *errstr;

};

===============================

/* INTERNAL FUNCTION

Initialize an error data strcuture

*/

voidfann_init_error_data(struct fann_error *errdat)

{

errdat->errstr = NULL;

errdat->errno_f = FANN_E_NO_ERROR;

errdat->error_log = fann_default_error_log;

}

 

Read fann_train_data from file:

xor.data

4 2 1

-1 -1

-1

-1 1

1

1 -1

1

1 1

-1

/*

* INTERNAL FUNCTION Reads training data from a file descriptor.

*/

struct fann_train_data *fann_read_train_from_fd(FILE * file, const char *filename)

.....

if(fscanf(file, "%u %u %u\n", &num_data, &num_input, &num_output) != 3)

num_data=4

num_input=2

num_output=1

4 2 1 //num_data, num_input, num_output

-1 -1 //input

-1 //output

-1 1 //input

1 //output

1 -1 //input

1 //output

1 1 //input

-1 //output

 

/*

*INTERNAL FUNCTION Reads training data from a file descriptor.

*/

struct fann_train_data *fann_read_train_from_fd(FILE * file, const char *filename)

{

unsigned int num_input, num_output, num_data, i, j;

unsigned int line = 1;

fann_type *data_input, *data_output;

struct fann_train_data *data =

(struct fann_train_data *) malloc(sizeof(struct fann_train_data));

if(data == NULL)

{

fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);

return NULL;

}

if(fscanf(file, "%u %u %u\n", &num_data, &num_input, &num_output) != 3)

{

fann_error(NULL, FANN_E_CANT_READ_TD, filename, line);

fann_destroy_train(data);

return NULL;

}

line++;

fann_init_error_data((struct fann_error *) data);

data->num_data = num_data;

data->num_input = num_input;

data->num_output = num_output;

data->input = (fann_type **) calloc(num_data, sizeof(fann_type *));

if(data->input == NULL)

{

fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);

fann_destroy_train(data);

return NULL;

}

data->output = (fann_type **) calloc(num_data, sizeof(fann_type *));

if(data->output == NULL)

{

fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);

fann_destroy_train(data);

return NULL;

}

data_input = (fann_type *) calloc(num_input * num_data, sizeof(fann_type));

if(data_input == NULL)

{

fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);

fann_destroy_train(data);

return NULL;

}

data_output = (fann_type *) calloc(num_output * num_data, sizeof(fann_type));

if(data_output == NULL)

{

fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);

fann_destroy_train(data);

return NULL;

}

for(i = 0; i != num_data; i++)

{

data->input = data_input;

data_input += num_input;

for(j = 0; j != num_input; j++)

{

if(fscanf(file, FANNSCANF " ",&data->input[j]) != 1)

{

fann_error(NULL, FANN_E_CANT_READ_TD, filename, line);

fann_destroy_train(data);

return NULL;

}

}

line++;

data->output = data_output;

data_output += num_output;

for(j = 0; j != num_output; j++)

{

if(fscanf(file, FANNSCANF " ",&data->output[j]) != 1)

{

fann_error(NULL, FANN_E_CANT_READ_TD, filename, line);

fann_destroy_train(data);

return NULL;

}

}

line++;

}

return data;

}

 

statistics

Hi,

Thanks for reply. I had a quick look to the code and you calculate 1st and 2nd

difference for different EMAs. Is it your input for training ??

What is a current statistics i.e. winners/losers ratio. Can you beat this ??

Percent Profitable Trades 77.0% 76.7% 77.3%

Number Trades 87 43 44

Number Winning Trades 67 33 34

Number Losing Trades 16 9 7

Krzysztof

Reason: