OnChartEvent Mouse Move - page 2

 
Just to provide an answer to the maybe not so obvious.

It is possible. But there are no functions provided to support this feature. You need to create them your own.

Here is an outline on what you would need to do.

You need to maintain a "map" of all objects. This map would be, depending on the design, quite intense in resource usage. And it takes for sure some effort to keep it up to date.

You'd need to track creation and deletion of objects, update the map accordingly.

The map would need to be two dimensional, use price and time as access operator and return you the objects name when accessing with these "x and y" coordinates.

If you are fit enough, you could create some type of hash map to make the map be smaller and not represent the whole space of the charts size.

Then you could make a "mouse hover" function to receive the objects name as the price/time coordinates match on the maintained map.

And you need a function to add newly created objects as well as delete them from the map as they get removed.

As a hint, it is possible to create objects that do not trigger an "object create" or "object delete" event. So if you would be monitoring a chart and some other program creates objects without triggering this event, you would miss them. To counter this, you would have to manually monitor the ObjectsTotal counter.


As you can see, maintaining the map, designing it's content and calculating it's access is quite some computational and programming work.

Therefore it is probably not provided by the terminal and needs to be created by one self.

But, just to be clear, it is possible.
 
Email Account:

I wonder why the following code does not make any print, i did think the Mouse Move Event is clear thing, but looks like dont work?

Normaly it should print "moved moved" i like to move it move it... but it does not print anything, why?

Is there not a mouse move event for charts? I want to know when the move move over objetcs or anything at which coordinate it is currently and so on, i did think the Mouse Move event is exactly what i need but i wonder now why it does not work?

Here: https://www.mql5.com/en/docs/event_handlers/onchartevent is an example! Start from there.
Documentation on MQL5: Event Handling / OnChartEvent
Documentation on MQL5: Event Handling / OnChartEvent
  • www.mql5.com
OnChartEvent - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Dominik Christian Egert #:
Just to provide an answer to the maybe not so obvious.

It is possible. But there are no functions provided to support this feature. You need to create them your own.

Here is an outline on what you would need to do.

You need to maintain a "map" of all objects. This map would be, depending on the design, quite intense in resource usage. And it takes for sure some effort to keep it up to date.

You'd need to track creation and deletion of objects, update the map accordingly.

The map would need to be two dimensional, use price and time as access operator and return you the objects name when accessing with these "x and y" coordinates.

If you are fit enough, you could create some type of hash map to make the map be smaller and not represent the whole space of the charts size.

Then you could make a "mouse hover" function to receive the objects name as the price/time coordinates match on the maintained map.

And you need a function to add newly created objects as well as delete them from the map as they get removed.

As a hint, it is possible to create objects that do not trigger an "object create" or "object delete" event. So if you would be monitoring a chart and some other program creates objects without triggering this event, you would miss them. To counter this, you would have to manually monitor the ObjectsTotal counter.


As you can see, maintaining the map, designing it's content and calculating it's access is quite some computational and programming work.

Therefore it is probably not provided by the terminal and needs to be created by one self.

But, just to be clear, it is possible.


i told myself that i know you can do it with reading the coordinate from the object because the mouse move event gives you also coordinate numbers, but you dont get directly from the mouse move event a response about which objectname is hover.

So your answer is also not very usefull, but you have at least explain which way you would slove it, thats better then doing like a teacher and telling people look here and there to make people thing there is maybe a direct solution.

maybe if somebody want he can also learn to work with canvas there are maybe more possible functions for canvas objects, but for now in this topic the question was only if you can get from mouse move event the object name directly and its not possible is the answer.

 
Welcome.

How you judge my answer is not useful, I find interesting.

I stated, it's not supported by the terminal, also I provided an outline on one possible solution.

Now I ask myself, who is "the teacher" here, judging the "usefulness" of my answer, and continuing your "community approach" for all others to find this thread, speaking on behalf of them, for their matter.

Is that an appropriate response in your eyes, as you demand to be served towards you, but incapable of acting or reacting in such way, mister "Email Account"?
 
Dominik Christian Egert #:
Welcome.

How you judge my answer is not useful, I find interesting.

I stated, it's not supported by the terminal, also I provided an outline on one possible solution.

Now I ask myself, who is "the teacher" here, judging the "usefulness" of my answer, and continuing your "community approach" for all others to find this thread, speaking on behalf of them, for their matter.

Is that an appropriate response in your eyes, as you demand to be served towards you, but incapable of acting or reacting in such way, mister "Email Account"?

Before you did write your first answer, if you would have read and understand my own answer then you should have see that i already did say i know you can get the object hover with mouse move event and reading coordinate from objetcs and compare that coordinate with the object coordinate, and so on, so why would you tell me then that i can do that if i already did tell i know that it is possible do to such codeing?

So what you have done is just repeat what i already say before, i have not make of course such a complete description how to read with mouse move and object coordinate the hover like you did try to explain your idea, but because that is not the question and interest of this topic, here everybody hoe search in google or anywhere else want to know if he can get the object name from mouse move event or not and you should not waist the time of this people with explaining other things, thats why i told you it was not really usefull, but its more ok then the anwser from the guy before you, he dont even have say anything if possible or not he just do like most other useless moderator here he tell go and look there and there maybe you find there a answer, so such things are complete useless and a reason why most developers have problems to code good things for metatrader because there are not enough good community behind.

Look even how carl schreiber did answer to my question he give me a tip about something which i already told also before i have find that, but he just give again same info and he just make it complicate as possible, instead of telling people put the 

ChartSetInteger(ChartID(),CHART_EVENT_MOUSE_MOVE,true);

into Oninit function to activate mouse move event, he just give again a link where somebody maybe find it hisself, so the moderrator here are complete useless often and if you ask them again they just tell you have you not read the site and such things, that is not looking like they want to help but they get payed from metaquotes to help build a good community but they dont give themself any good support to community they just try always to do so less work as possible but if they would give more often good code solution instead of useless links then people later which come into the same problem will find directly the answer and they dont need to ask, but the way how they do here everybody ask again and again same questions and nobody really do much effort to give good helpfull answers.

always if somebody ask here something moderators dont want to help really threy first try to find a mistake in the questions and such things, you feel really how they dont want to give real help and that is demotivating.

So i hope you have understand a little bit more now, bye the way your idea about how to read objects coordinate creating maps and so on i find personally to much complicate, if i want i could slove it much easyer but i just wanted to know here if there is maybe a way to read directly from mouse move event the hover on a object, and it looks like i have answer myself my question with no its not directly possible.

 
Email Account #:


 but they get payed from metaquotes to help build a good community but they dont give themself any good support to community they just try always to do so less work as possible

You should understand that:
1)the moderators are not paid they are volunteers.
2) most people here are not programmers and if just spoon fed answers simply come back with the next problem they encounter rather than try to solve it themselves hence why it is often better to point them at the documentation in the hope they learn to go there first next time


 
Paul Anscombe #:
You should understand that:
1)the moderators are not paid they are volunteers.
2) most people here are not programmers and if just spoon fed answers simply come back with the next problem they encounter rather than try to solve it themselves hence why it is often better to point them at the documentation in the hope they learn to go there first next time


You are absolutely correct.

Unfortunately some ungrateful posters just moan and bleat when they don't get the answers that they want. That is despite the replies here being extremely useful and I am sure will be very helpful to others that find this thread in future.

I don't know why he is complaining about moderators. Prior to this , a moderator has not replied in this topic.

I would like to thank all that have replied in this topic, you are all valuable contributors to this forum and I know that you are much appreciated by many . Please don't let the ungrateful few put you off helping others. Those ungrateful few are not contributors, they are just takers.

 
Paul Anscombe #:
You should understand that:
1)the moderators are not paid they are volunteers.
2) most people here are not programmers and if just spoon fed answers simply come back with the next problem they encounter rather than try to solve it themselves hence why it is often better to point them at the documentation in the hope they learn to go there first next time


the documentation of mql language is very poor of usefull examples, there are not much websites where you can find usefull help like for many other codeing languages and if the moderrator here at this forum even dont give much help it is no wonder that the community have not become stronger and that every where scammers are trying to sell grid EAs.

 
Keith Watford #:

You are absolutely correct.

Unfortunately some ungrateful posters just moan and bleat when they don't get the answers that they want. That is despite the replies here being extremely useful and I am sure will be very helpful to others that find this thread in future.

I don't know why he is complaining about moderators. Prior to this , a moderator has not replied in this topic.

I would like to thank all that have replied in this topic, you are all valuable contributors to this forum and I know that you are much appreciated by many . Please don't let the ungrateful few put you off helping others. Those ungrateful few are not contributors, they are just takers.

sometimes it is more helpfull to get a clear no answer instead of links and infos like maybe you find it there. my topic here is a good example for that, if i would not have find out myself that it is not possible till today nobody would have say it, that you can not get object names directly from mouse move event, but they all give tipps and tell what they think instead of giving real usefull answer and help. now everybody hoe search in future for such thing can read it directly here that it is not possible and he can concentrate on other solutions directly without waisting his time to search and read all other links.

 
Email Account #:

sometimes it is more helpfull to get a clear no answer instead of links and infos like maybe you find it there. my topic here is a good example for that, if i would not have find out myself that it is not possible till today nobody would have say it, that you can not get object names directly from mouse move event, but they all give tipps and tell what they think instead of giving real usefull answer and help. now everybody hoe search in future for such thing can read it directly here that it is not possible and he can concentrate on other solutions directly without waisting his time to search and read all other links.

If you don't like the helpful answers that you have been given, you don't have to use the forum. Feel free to go elsewhere. You won't be missed.