Examples: Using Neural Networks In MetaTrader - page 10

To add comments, please log in or register
Bruno Souza
750
Bruno Souza  
Stephen Davies :
Hello, and thank you for your great tutorial! Im looking to learn more about ANN's using this tutorial and code, however I cant seem to get it to compile. Metaeditor4 seems to complain that at line 88 & 116 "path" parameter conversion is not allowed. I have never experienced this error, and after some googling am still at a loss on how to fix it to be able to test out the code. Does anyone have any ideas what might be causing this?

I have the same problem. Is this code compatible with the current version of metatrader? my build(1090, v4.00)

pmorphy
6
pmorphy  

This code works for the problem, change it

int ann_load (string path)   //Inicialización de las Neuroredes
{
    int ann = -1; uchar p[];StringToCharArray(path,p,0,-1,CP_ACP);         
    ann = f2M_create_from_file (p);   // Cargar neurored ANN 
    if (ann != -1) {debug (1," Neurored ANN: '" + path + "' cargada con éxito. Su manejador: " + ann);}
    if (ann == -1) {ann = f2M_create_standard (4, AnnInputs, AnnInputs, AnnInputs / 2 + 1, 1);
         
         f2M_set_act_function_hidden (ann, FANN_SIGMOID_SYMMETRIC_STEPWISE);  //Activación neuronas de la capa oculta
         f2M_set_act_function_output (ann, FANN_SIGMOID_SYMMETRIC_STEPWISE);
         f2M_randomize_weights (ann, -0.4, 0.4);    //Inicialización de los pesos de las conexiones de las neuronas dentro de la red. Valores aleatorios.
         debug (1," Neurored ANN: '" + path + "' creada con éxito. Su manejador: " + ann);}

    if (ann == -1) {debug (0, "ERROR ¡INICIALIZANDO NEURORED!");}
    return (ann);
}

void ann_save (int ann, string path)       //FUNCION GRABAR DATOS
{
    int ret = -1; uchar p[];StringToCharArray(path,p,0,-1,CP_ACP); ret = f2M_save (ann, p);
    debug (1, "f2M_save(" + ann + ", " + path + ") resultado: " + ret);
}
Bruno Souza
750
Bruno Souza  
pmorphy :

This code works for the problem, change it

This way it worked. Thank you.

pmorphy
6
pmorphy  
Bruno Souza:

This way it worked. Thank you.

Replace in Fann2MQL.mqh

int f2M_create_from_file(string path);
int f2M_save(int ann,string path);

to 

int f2M_create_from_file(char &path[]);
int f2M_save(int ann,char &path[]);
To add comments, please log in or register