
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
You don't need an index or whatever to "keep track of the X/Y coordinates of multiple OBJ_RECTANGLE" ? That's not even a use case. An OBJ_RECTANGLE is using time/price coordinates, so what is the real use case ? When you have the name of an object just use the appropriate functions to get the object data you want.
Anyway, it's trivial to get the coordinates of an object, no need for an "index", it's trivial to get the coordinates of the mouse. And so it's trivial to check the mouse is inside an object. And that's right mql5/MT5 will not do it for you, you have to code it, that's what I called "live with reality" instead of being sarcastic about what the platform don't provide and will never provide.
Alain, incorrect again, tracking the mouse pointer coordinates to see if they are over a visible object on the chart is indeed a use case. Otherwise, please define what your idea of a "use case" is and I'll be happy to give you one. They're obvious and easy.
I asked you to show HOW you would detect if the mouse pointer is over a visible chart object -- precisely because "An OBJ_RECTANGLE is using time/price coordinates." You did not do that. Telling me it's "trivial" is known as a nonresponse, "a refusal or failure to respond". https://www.merriam-webster.com/dictionary/nonresponse. It's uninformative. Maybe you know something I don't. You make claims about your knowledge -- why won't you reveal your knowledge?
I know how I'm doing it. I wanted to see how you would do it. Obviously, then, either you won't or can't explain how.
Besides, if it's so trivial, then it should take nothing at all to whip together the steps you'd use to do it. Why won't you?
" instead of being sarcastic about what the platform don't provide and will never provide"
Thanks for confirming that you are not reacting to my factual statements, you are reacting to my tone. More precisely, you are reacting to your own misread of my tone. I was not being sarcastic anywhere. I was not being rhetorical. Nor was I trying to hide my criticism of MQL. I was sincere throughout. I said exactly what I meant. And with "the platform don't provide and will never provide" you also confirmed ample cause for criticism and ample justification for me to call that very lack of provision a "deficit".
All this is actually very funny, because MQL provides exactly the kind of function for charts that I've pointed out it "don't provide and will never provide" for objects.
I assume you're familiar with the ChartID() function.
Why in the name of all that's intelligent would there be a ChartID() function but no ObjectID() function? They serve exactly the same purpose.
What's more, all of this would be moot if MQL enabled arrays to be accessed using string indexes. But that's also functionality, I'm sure, it "don't provide and will never provide".
And that just now was the first time in this thread that I have been sarcastic. You have given me ample reason to.
What's more, my original question to you stands ignored, let alone answered. Here it is one more time.
"So how am I supposed to know when the mouse pointer is hovering over one of the objects I've created on a chart?"
Good to know it's trivial tho, lol.
I assume you're familiar with the ChartID() function.
Why in the name of all that's intelligent would there be a ChartID() function but no ObjectID() function? They serve exactly the same purpose.
What exactly is the problem that you look a solution for?
Amir, I've already said plenty that answers your questions here. In a nutshell, none of the algorithms in question need the object's name, and yes I know how to get it. In fact, to keep functions as independent from each other as possible and as generally useful as possible, I do not want them to know an object's name.
So let's say, for an OBJ_RECTANGLE, I have figured out the X/Y coordinates of its upper left and lower right corner as it appears on a chart. MQL does not provide these. As Alain so astutely pointed out, I need to figure that out in my own code. So I did. Every time I create an object (now that I have my own list of object names and know what their indexes are) I can add an element to an array that holds the X and Y coordinate for top left and bottom right corners, giving me everything I need to be able to calculate geometry for that rectangle. Where am I going to put it? In an array, of course. Let's say I use a 3D array with range 0 as the object ID dimension, range 1 as the X/Y coordinate dimension, and range 2 as the top-left/bottom-right dimension. I might write the following, where ciXidx is a constant = 0 and ciYidx is a constant = 1:
Then I'd call it once for the top left corner (TLC) and once for the bottom right corner (BRC):
IndexRectCorners(iObjID,iXvalue,iYvalue,ciTLC ); // where ciTLC is constant = 0 IndexRectCorners(iObjID,iXvalue,iYvalue,ciBRC); // where ciBRC is constant = 1
Now I have all the data I need to calculate geometry for the object identified by iObjID stored in iRectCorner[][2][2]. Or, so save memory space (if that's a concern) I could store that same information in 4 1-D arrays, one for X, one for Y, on for TLC and one for BRC, all like indexed by the same iObjID value. If and when I need the name I can get it. If and when I don't need it, I'm not forced to use it to get the object's unique numeric ID.
This way I can use the IndexRectCorners() function and the iRectCorner array (or the four 1-D arrays I mentioned) for a single, specific object or to loop through the entire list of objects on the chart without having to know their names at all. I can logically link other relevant arrays using the object's iObjID.
I have amply responded to your questions, so I'll ask my question to you (which so far you have ignored) one more time (see my reply to you above):
"Q-1: No, the index values are not "only used" to get object names. If I collect data about objects that would mean (simplest case) an array which by definition involves one index per dimension. How do you propose you'd know which object the 2nd element of that array refers to?"
Amir, I've already said plenty that answers your questions here. In a nutshell, none of the algorithms in question need the object's name, and yes I know how to get it. In fact, to keep functions as independent from each other as possible and as generally useful as possible, I do not want them to know an object's name.
So let's say, for an OBJ_RECTANGLE, I have figured out the X/Y coordinates of its upper left and lower right corner as it appears on a chart. MQL does not provide these. As Alain so astutely pointed out, I need to figure that out in my own code. So I did. Every time I create an object (now that I have my own list of object names and know what their indexes are) I can add an element to an array that holds the X and Y coordinate for top left and bottom right corners, giving me everything I need to be able to calculate geometry for that rectangle. Where am I going to put it? In an array, of course. Let's say I use a 2D array with range 0 as the X/Y coordinate dimension and range 1 as the top-left/bottom-right dimension. I might write the following, where ciXidx is a constant = 0 and ciYidx is a constant = 1:
Then I'd call it once for the top left corner (TLC) and once for the bottom right corner (BRC):
Now I have all the data I need to calculate geometry for the object identified by iObjID stored in iRectCorner[][][]. Or, so save memory space (if that's a concern) I could store that same information in 4 1-D arrays, one for X, one for Y, on for TLC and one for BRC, all like indexed by the same iObjID value. If and when I need the name I can get it. If and when I don't need it, I'm not forced to use it to get the object's unique numeric ID.
This way I can use the IndexRectCorners() function and the iRectCorner[][][] array (or the four 1-D arrays I mentioned) for a single, specific object or to loop through the entire list of objects on the chart without having to know their names at all. I can logically link other relevant arrays using the object's iObjID.
I have amply responded to your questions, so I'll ask my question to you (which so far you have ignored) one more time (see my reply to you above):
"Q-1: No, the index values are not "only used" to get object names. If I collect data about objects that would mean (simplest case) an array which by definition involves one index per dimension. How do you propose you'd know which object the 2nd element of that array refers to?"
We have an other troll here.
We have an other troll here.
I suggest that you better read or look for solutions to what you think are problems, because they are not. Maybe you did not quite get the whole concept of the evironment in which mql5 lives and interacts with. If I understand you rightly, you keep x and y coordinates in an array. Now what if a user comes and moves your object manuly or another program does it? What about your array?
Sorry man, asked and answered more than once. Please read what I wrote.
We have an other troll here.
The fact that you refused to respond to legitimate, reasonable requests from me makes me a troll?
LMAO man, you're funny.
Please EXPLAIN HOW THAT WORKS.
I'm no troll, especially not just because you call me one. But that's neither here nor there.
I won't respond further on this thread, I got all I could from it. Let's move on.