You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Forum on Trading, Automated Trading Systems and Strategy Tests
FAQ from Beginners MQL5 MT5 MetaTrader 5
Aleksey Vyazmikin, 2019.02.17 06:56
I decided to repeat the experiment again, here is the code
And here is result
Any idea what caused the error?The telepaths are on holiday. And for ordinary people we need:
Where were you told that there was an error? I told you - look for the point in the library where it may be written into the _LastError variable. It's not necessarily that the code with the error has worked. Because it might search for an object (and if it is absent, the error code will be written into the variable) and create it. But if object won't be created, it's an error, but it will be created and everything will work out. But after checking, the error code (the object was absent before creation) will be written into a variable, which you then read in your code.
Telepaths are on holiday. What is needed for ordinary people is:
1. Code
2. No expectation of error messages in the log
3. Windows 7 Home 32 bit, build 1940, not connected to the server during testing - broker Discovery.
Where have you been told that there is an error? I told you - look for a fragment in the library where it may be written into the _LastError variable. It's not necessarily that the code with the error worked. Because it might search for an object (and if it is absent, the error code will be written into the variable) and create it. But if object won't be created, then it's an error, but it will be created and everything will work out. But after checking, the error code (the object was absent before creation) will be written into a variable, which you then read in your code.
The library must either produce an error when there is an actual error, or correctly handle the situation and not produce an error where there is none. If my use of the library is not described in the class when checking for errors, you should specify it. At any rate, it's unreasonable for the user to edit the product's manufacturer's libraries.
The library must either produce an error when there is an actual error, or correctly handle the situation and not produce an error where there is none. If my use of the library is not described in the class when checking for errors, you should specify it. At any rate, it's unreasonable for the user to edit the product's manufacturer's libraries.
There is no error there, read it again:
Where were you told there was an error? I told you - look for a fragment in the library where it may be written into the _LastError variable. It's not necessarily that the code with the error has worked. Because it might search for an object (and if it is absent, the error code will be written into the variable) and create it. But if object won't be created, then it's an error, but it will be created and everything will work out. But after checking the error code (the object was absent before creation) will be written into a variable which you will then read in your code.
So it's only your interest to know why you read the error after the code's normal execution. What you do not understand is that the presence of code other than zero in the _LastError variable does not necessarily mean that there is an error in CGraphic's code and not only in it. In this case, it could be a simple result of searching for the existence of an object, which was executed inside the CGraphic in SB. There was a request for an object by name, the result returned -1 and code 4202 was written into _LastError. Then the object was created, everything worked and was returned to the calling program. And there you immediately read the error code and get it. But there is no error - you see the result of queries inside the SB.
I am only suggesting a possible reason for what you are reporting.
So, if you really want to find a real error and report it, you need to go through the whole CGraphic code in the debugger and catch the real error that will lead to logic and performance failures, rather than just claiming that you read the error code and therefore - it is definitely there.
There is no error there, read it again:
So - it's only your interest to know why you're reading the error after the normal code execution. You probably do not understand that the content of the _LastError variable, which is not zero, does not necessarily mean that there is an error in the CGraphic code, and not only in it. In this case, it could be a simple result of searching for the existence of an object, which was executed inside the CGraphic in SB. There was a request for an object by name, the result returned -1 and code 4202 was written into _LastError. Then the object was created, everything worked and was returned to the calling program. And there you immediately read the error code and get it. But there is no error at all - you see the result of queries inside the SB.
I'm only suggesting a possible reason for what you're reporting.
So if you really want to find the real error and report it, then you need to go through the whole CGraphic code in the debugger and catch the real error that will cause the logic and operation to fail, rather than just claiming that you have read the error code and therefore - it is definitely there.
You yourself said in your logical reasoning that there could be an error in the code, and it is expressed in not resetting the error. which was received due to lack of an object before it was created.
No, I don't have the competence to look for an error in complex code and then get an answer that it was intended that way.
Can you please tell me if this message is a user error or not?
The code that points to this isD.PointsFill(false);
You yourself have indicated in your logical reasoning that there may be an error in the code, and it is expressed by not resetting the error. which was received due to the absence of the object before it was created.
No, I don't have the competence to look for an error in complex code and then get an answer that it was intended that way.
Can you please tell me if this message is a user error or not?
It points to this code -D.PointsFill(false);
I don't understand the meaning of the phrase at all.
It seems to me that I've already described everything to you in detail.
I don't know. Not much information.
I don't understand the meaning of the phrase at all.
It seems to me that I have already explained everything to you in detail.
I don't know. Not much information.
You don't understand that if your code is built to react to an error (we create an object in case of an error), then after fixing the error(creating an object) it is logical to reset this error, which according to your logical reasoning is not done in the library.
Here I also don't have information how to react to this error...
You don't understand that if the code is built on error response (in case of error we create an object), then after error correction(object creation), it is logical to reset this error, which according to your logical reasoning is not done in the library.
Here I have no information on how to react to this error...
You must be well aware that it is not the code in _LastError that is not equal to zero that is an error, but the result returned by the function that indicates the erroneous execution of this 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 cause of return of some result returned 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 standard 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 explicitly says that "An object with the requested name does not exist" - you can create it.
Well, I'm tired of explaining it to you. Whoever wants to, will understand.