Errors, bugs, questions - page 2786

 
Юлия:

Good afternoon, Gentlemen. I couldn't find the answer on the Internet.

I am switching from mql4 to 5 for the sake of testing several pairs at a time. And I got a bit confused.

If I indicate a certain symbol in the code, then trades should be opened by the specified symbol. The optimizer for EURUSD displays different data on the optimization results than for some other pairs. Where is the truth anyway? (

Maybe you forgot to "select a symbol" using SymbolSelect function

... it's enough to select once in initialisation

 
Alexandr Sokolov:

You may have forgotten to "select a symbol" using the SymbolSelect function

... it's enough to select once in the initialization

))))) it turns out it's about ticks. Since data is returned with a new tick, they do not coincide on different pairs ) and while we were waiting for a tick at the tested EURUSD chart, it may have already changed... ) what a non-obvious thing.

 

Can you tell me why a file reference error occurs from the script? More precisely, how do I know what's causing it?

         string   dirNC    = dir_NC+"MLP\\";
                  filename = dirNC+name+".ncmlp";
         int h=FileOpen(filename, FILE_BIN|FILE_READ);
         ResetLastError();
         if(h == INVALID_HANDLE)
         {
            Print("Ошибка Загрузки сети >>> "+filename);
            Print("LastError = "+GetLastError());
            return;
         }
2020.06.24 11:30:14.815 NNC_training (EURUSD,H3)       Ошибка Загрузки сети >>> NCmZZ3\FXTM\EURUSD_PERIOD_H3\2_48_24_2160_24_VECTOR_UP\MLP\modul_1.ncmlp
2020.06.24 11:30:14.815 NNC_training (EURUSD,H3)       LastError = 0
 
Сергей Таболин:

Can you tell me why a file reference error occurs from the script? More precisely, how do you know what is causing it?

why do you reset the error after getting a handle?

 
awsomdino:

why do you reset the error after getting the handle?

Oops... I'll fix it right away.


ERR_CANNOT_OPEN_FILE

5004

File opening error.


That's pretty obvious. But why?

This file was created by another script. It was written, closed, then reopened for checking and closed. But it was under a different name and in a different folder.

 
Сергей Таболин:

Oops... I'll fix it right away.

      if(h == INVALID_HANDLE)
        {
         Print("Ошибка Загрузки сети >>> "+filename);
         Print("LastError = "+GetLastError());
         if(_LastError==0)
            Alert("Assert!)");
         return;
        }
 
did you put a mark on it?

?

or is the file definitely closed?

 
awsomdino:
mark

?

Or is the file definitely closed?

I haven't set the shara. The file is not accessed by anyone else except this script. It was renamed and copied to my desired folder manually.

By the way. I noticed a similar situation with indicators.

If I create a new subfolder in the "Indicators" folder and copy an indicator and its source code there, an error will occur at tracing. It is fixed by recompilation of indicator in this new folder....

 
Сергей Таболин:

I haven't set the balloon. The file has not been accessed by anyone else except this script. It was renamed and copied to the folder I wanted by hand.

By the way. I noticed a similar situation with indicators.

If I create a new subfolder in the "Indicators" folder and copy an indicator and its source code there, an error will occur at tracing. It can be solved by recompilation of indicator in this new folder....

did you check the filename variable? is everything there in the name correct? it seems that the folder path is incorrect

 
awsomdino:

did you look at the filename variable? is everything in there correct? it looks like a crooked folder path

Thank you. That's where one letter didn't dance.

It's just that for me " file opening error" looks like "file exists, but could not be opened". But "File not found" would be just right ))))