Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1003

 
Aleksey Vyazmikin:

Answered you there, and there is no interest in what I have described - not justified.

If there is no interest, then why did you ask about the reasons after explaining the possible reason? It wasn't me who asked... When I am interested (have an interest), I ask.

Or do you want to satisfy your interest and have someone else look into it to show you something? Ok. Looked into it. CCanvas is used there. I think when creating a canvas object its existence is checked (and it's absent at first call - so code for lack of canvas object is written into _LastError). I didn't look through the code - I've got my own things to do.

 
Artyom Trishkin:

If there is no interest, why did you ask for reasons after giving a possible reason? I wasn't the one who asked... When I am interested (have an interest), I ask.

Or do you want to satisfy your interest and have someone else look into it to show you something? All right. Looked into it. CCanvas is used there. I think when creating a canvas object its existence is checked (and it's absent at first call - so code for lack of canvas object is written into _LastError). I didn't look through the code - I've got my own things to do.

Thank you for your hard work! Now we know that it's a good idea to reset this error there after creating an object.

 
Vitaly Muzichenko:

Try adding a line, it might help

try

 
Aleksey Vyazmikin:

Thank you for your hard work! Now we know it's a good idea to reset that error there after creating an object.

Forum on trading, automated trading systems and strategy testing

Testing CGraphic - Questions and Suggestions

Artyom Trishkin, 2019.02.17 09:41

You should clearly understand that it's not the code different from zero in _LastError that is an error, it is the result returned by the function which indicates the erroneous execution of that function. And _LastError contains code that exactly points to that error which causes the function to execute by mistake. So it's doubtful that you can use the description of the error code stored in the service variable instead of using the return code of the function directly. If the function returned -1 or false or 0 (for each function its error code is described in the help), well - only the analysis of result returned by the function should be handled by you, not the code in _LastError, which doesn't indicate the error, but is used to indicate the reason for returning some result by the function.

The object search function returns a value less than zero in case an object with the given name doesn't exist. Is it an error? No. This is a regular response of the function, on the basis of which you make a decision about creating an object with the given name. The code contained in _LastError directly says that "There is no object with the requested name" - you can create it.

Well, I'm tired of explaining it to you. Whoever wants to, will understand.


 
Vitaly Muzichenko:

Try adding a line, it might help

Tried it, didn't work, I think there's a problem with my computer, I'll try it on another computer

 
Denis Nikolaev:

Tried it, didn't help, I think there's a problem with the computer, I'll try it on another computer

Same situation on another computer ( , where to go next?

code, if it helps at all

int OnInit(){

MQLSetInteger(MQL_CODEPAGE,CP_ACP);
string File_Name;
int file_handle;
string;
File_Name="format.txt";
file_handle=FileOpen(File_Name,FILE_READ|FILE_TXT);
if(file_handle!=INVALID_HANDLE){
while(!FileIsEnding(file_handle)){
line=FileReadString(file_handle);
Alert(line);
}
}else
Alert("File format.txt couldn't be opened");
FileClose(file_handle);
return(INIT_SUCCEEDED);
}

 
Denis Nikolaev:

Same situation on the other computer ( , where to go next?

Then you need the code to read the file

 
Artyom Trishkin:
Anyway, I'm tired of explaining it to you. Whoever wants to, he'll understand.

He won't understand. He's told to drop it BEFORE... he understands as AFTER...


Forum on trading, automated trading systems & Forex trading strategies testing

FAQ from Beginners MQL5 MT5 MetaTrader 5

Aleksey Vyazmikin, 2019.02.17 09:33

Thank you for your hard work! Now we know it's a good idea to reset this error there after creating an object.


 
Denis Nikolaev:

Same situation on the other computer ( , where to go next?

code if it helps

int OnInit(){

MQLSetInteger(MQL_CODEPAGE,CP_ACP);
string File_Name;
int file_handle;
string;
File_Name="format.txt";
file_handle=FileOpen(File_Name,FILE_READ|FILE_TXT);
if(file_handle!=INVALID_HANDLE){
while(!FileIsEnding(file_handle)){
line=FileReadString(file_handle);
Alert(line);
}
}else
Alert("File format.txt couldn't be opened");
FileClose(file_handle);
return(INIT_SUCCEEDED);

}

contents of format.txt any, if no file "Failed to open format.txt" is displayed correctly



Files:
alert.png  83 kb
 
Alexey Viktorov:

He won't understand. He is told to drop BEFORE... he understands as AFTER...



Are you even paying attention, or are you just waking up???

Reason: