What do the pros have to say: How to get mouse scroll values in MQL? [repost from the fifth forum]. - page 7
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
What will help him? Your eulogy? You haven't shown a solution. You showed yourself. Which is very, very much to be expected.
Is that what it is?
You have the wrong tendency. You first shout things at me (like "your code is crap", "necroposter"), and then ask and discuss the solution to the problem. So, think for yourself.
Or wait for me to help those who deserve it.
What will help him? Your eulogy? You haven't shown a solution. You showed yourself. Which is very, very much to be expected.
You are remarkably inattentive.
Look, at the bottom of the post to which I responded, the man is asking for "pointers". He's not asking for a solution. So I tried to push him. Now do you see how inappropriate and ridiculous your interference is? It entails nothing but useless rubbish. You'd be better off communicating on the merits. You'd be doing yourself and others more good.
You have the wrong tendency. You first shout things at me (like "your code is crap", "necroposter"), and then ask and discuss the solution to the problem. So, think for yourself.
Or wait for me to help those who deserve it.
I wasn't asking, I was stating a fact.
I wasn't asking, I was stating a fact.
Here, many people do not see the content behind the form. They cannot understand that if there is no idea and no ability to realise it, their insistence on form will not produce quality content.
The essence can have many forms of its embodiments and only an incompetent person can judge it by the language of its expression.
I wasn't asking, I was stating a fact.
I, too, will state a fact.
your "products" are a talentless and ridiculous effort.
This is the most rubbish I have seen in a long time!
Don't take truthful criticism to heart. :)
Why? A little thought process and everyone will find a solution. I gave you a hint where to look for it. In what direction to investigate. It's not interesting to have everything on a silver platter. )) If you need, I can help the man and lead him to a solution. But it seems that you just want to argue with me).
Hello, Peter!
Don't you want to say you have a practical solution, how to scroll the mouse wheel by means of MQL? And not with keyboard arrows or mouse buttons - it's not that difficult to understand. Of course, we can use event CHARTEVENT_CHART_CHANGE to determine whether the chart is scrolling with wheel, if no keys are pressed, but only probabilistically, because this event can occur just with a new bar coming or a sharp price change, leading to a change of vertical scale. Also, with this method it is not possible to always get the wheel scrolling event, for example when the chart has reached the extreme left or right position, and how to achieve this without scrolling the chart. Maybe you mean to use ChartNavigate function to move the chart back, but that would be a very crooked implementation and it is unlikely to filter out correctly all other reasons for chart changes, other than scrolling the mouse wheel. In my mind, it can only be done by hacking MT or knowing some undocumented commands and/or events. Anyway, I don't believe that you have an example of such implementation.
And you have a strange hint, though. Almost to the question "How to get scrolling event via mouse wheel?", you give the answer"Use scrolling event and a function that moves the graph."
Maybe I'm wrong, and you actually have an example. You're a cool guy then! )) Well, then at least drop the ex4 (ex5) file, not the code.
Hi Peter!
Don't you want to say that you have a practical solution of how to scroll with the mouse wheel in MQL? And not with keyboard arrows or mouse buttons - it's not that difficult to understand. Of course, we can use event CHARTEVENT_CHART_CHANGE to determine whether the chart is scrolling with wheel, if no keys are pressed, but only probabilistically, because this event can occur just with a new bar coming or a sharp price change, leading to a change of vertical scale. Also, with this method it is not possible to always get the wheel scrolling event, for example when the chart has reached the extreme left or right position, and how to achieve this without scrolling the chart. Maybe you mean to use ChartNavigate function to move the chart back, but that would be a very crooked implementation and it is unlikely to filter out correctly all other reasons for chart changes other than mouse wheel scrolling. In my mind, it can only be done by hacking MT or knowing some undocumented commands and/or events. Anyway, I don't believe that you have an example of such implementation.
And you have a strange hint, though. Almost to the question "How to get scrolling event via mouse wheel?", you give the answer"Use scrolling event and a function that moves the graph."
Maybe I'm wrong, and you actually have an example. You're a cool guy then! )) Well, then at least drop the ex4 (ex5) file, not the code.
Hi Nikolay!
Believe it or not, the solution is very simple. It takes 15-20 lines of code. There is one subtle point, though - the specifics of implementation of the scrolling mechanism. My implementation differs a bit from the standard one. It scrolls canvas, not objects. There is a similar implementation in Anatoly's library.
I do scroll with the wheel and by "clinging" to the motion of the chart I get an energizing effect. Of course, the chart twitches but always comes back to its initial position. That is what the chart shift function is for. The chart shift direction is also obtained from the mql-function. Thus, I don't have to hack anything). MQ has tried to give the widest possible functionality to implement almost any task. This is even surprising. Maybe they themselves did not know all the features they open for developers).
Anyway, I don't believe you have an example of such an implementation.
And you have a strange hint, though. Practically to the question "How to get scrolling event via mouse wheel?", you give answer "Use scrolling event and function which moves graph."
Maybe I'm wrong, and you actually have an example. You're a cool guy then! )) Well, at least drop the ex4 (ex5) file, not the code.
Here's the situation. The person to whose post I replied, asked me to give him an idea, how to implement a scrolling mechanism with a wheel. I gave him a hint. Immediately local ill-wishers flared up and started accusing me of bragging and some other nonsense.
From their point of view, if I give a solution, then I'm either advertising my products, or just bragging, and if not, then I'm cheating and I have nothing.
I can give you the code, but firstly, it will be detached from the implementation of the scrolling mechanism, and secondly, it will be in Russian. But maybe you can adapt it to your scrolling mechanism. I can not put eh4, because I can not "tear" a single mechanism from the graphical environment in which it operates.
The best option, would be to give you the solution in general terms, but not with the aim of proving anything, but on the basis of friendship.
And so:
The CHARTEVENT_CHART_CHANGE event is generated, among other things, on the mouse wheel movement event if the cursor is over the graph. The chart offset option must be enabled. Thus, from the chart offset, we can know exactly when we spin the wheel. We can generate a custom event. For example "SCROLLER_EVENT".
Next, our task is to determine the direction of the offset. We use ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR); at each "SCROLLER_EVENT" event we get the number of the first visible bar and determine whether it is more or less than the number of the previous bar that we recorded. If it is more, then it moves in one direction; if it is less, then it moves in the opposite direction. At the same time, our chart will also scroll and can reach the very end. To prevent this, we correct its position using the ChartNavigate function and set the chart at its initial position. This call also generates the CHARTEVENT_CHART_CHANGE event and it will disable our scrolling. So, at the time of chart position correction we must skip the CHARTEVENT_CHART_CHANGE event and not react to it. This requires the use of a flag system.
This is what my code looks like:
Added:
As for other causes of chart shifts, of course, they can introduce errors into our system. However, these errors are so insignificant that we should not pay much attention to them. So if the new bar moves our canvas a few pixels... It's not a big deal. And that's only if the cursor will be over the scroll bar at that time.
Of course, the implementation is an attempt to find a way out of a hopeless situation. With the complete lack of scrolling with the wheel, this is the simplest and most "native" solution. For a full-fledged solution, I've already contacted servicedesk. Whether it is or not depends on the developers.