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
Just started to learn MQL, and here I wrote an EA that draws an iMA and draws a tangent (very close) to the chart in the iMA at the point where the mouse pointer is on the time axis.
Problem one. The Expert Advisor is VERY slow. It means that the tangent is redrawn for a long time and it does not follow the movement of the mouse...
Look at my version:
On my laptop - everything flies!
I get error 5040 (Corrupted parameter of type string) the first time I call the object creation function
If before a call set
nTL="";
error 4002 (Invalid parameter when calling the client terminal function internally)
If set before the call
nTL="a";
the first object will be named a.
I call it this way
Could you tell me where is an error?
In the old version.
never had any failures.
Is it a bug in the code or in the terminal?
Can you tell me where the error is?
I get error 5040 (Corrupted parameter of type string) the first time I call the object creation function
If before a call set
error 4002 (Invalid parameter when calling the client terminal function internally)
If set before the call
the first object will be named a.
I call like this
Can you tell me where the error is?
Are you worried because Get LastError prints something other than zero? If so, you should only call for an error if the function reports a failure. And you shouldn't ask for an error at the end of the plot, you might get a rubbish value. This is how it is in MT4, maybe it is different here.
Pseudocode:
I get error 5040 (Corrupted parameter of type string) the first time I call the object creation function
If before a call set
error 4002 (Invalid parameter when calling the client terminal function internally)
If set before the call
the first object will be named a.
I call it this way
Could you tell me where the error is?
Try "gluing" strings through StringConcatenate()
I don't know where the error is, but the handling of object names is very questionable to put it mildly.
It's not clear why you need a random number in the object name, it could lead to an error.
Is there another option for a couple of hundred objects with unique names?
(A group of objects should have the same part of the string in the name, to remove the group.)
Are you worried because Get Last Errors prints something other than zero? If so, you should only ask for an error if the function reports a failure. And you shouldn't ask for an error at the end of the plot, you might get a rubbish value. That's how it is in MT4, maybe it's different here.
Are you worried because Get Last Errors prints something other than zero?
Well, logically, if the function sets last error at all, then on successful completion of the function there should be a zero error or the value described in the documentation. There is no other way.
That is, if the call was successful and the error is non-zero, this case must be described in the documentation.
I will be racking my brains this way for another week. May I give you some more details? (You may be crude :))
Well usually names of objects of the same type are formed from common part, for easy removal ("nTL_" in your case) and differences. I also use module identifier, if there can be more than one of these very modules at once on the chart.
The difference can be anything at all, even a counter, which you increase every time you create an object. But it's better to make distinctions by logic -- object time, object coordinate, the goal is to achieve guaranteed uniqueness. The side effect is that by constructing a name again, you can change the properties of an already created object.
Random does not provide this "guaranteed uniqueness".