Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1461
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
I can't figure out how to do it.
When the mouse wheel scroll event occurs, the code is executed.
The mouse wheel can be scrolled for several clicks at a time, and we will get not one event with dparam = number of clicks, but several events with dparam = +/-120.
The code is executed for some time, which is much longer than the time between clicks when scrolling the mouse wheel.
As a result, it turns out that nobody is scrolling the mouse wheel anymore, and the programme continues to recalculate for some more time.
The mouse wheel scrolled at 15:12:22.820 and then the programme was executed 5 more times, for 5 whole seconds.Question: how to execute the programme code once instead of several times.
That is, the wheel scrolled for 5 clicks, delta = dparam / 120 * 5.
I can't figure out how to do it.
When the mouse wheel scroll event occurs, the code is executed.
The mouse wheel can be scrolled for several clicks at a time, and we will get not one event with dparam = number of clicks, but several events with dparam = +/-120.
The code is executed for some time, which is much longer than the time between clicks when scrolling the mouse wheel.
As a result, it turns out that nobody is scrolling the mouse wheel anymore, and the programme keeps recalculating for some more time.
The mouse wheel scrolled at 15:12:22.820 and then the programme was executed 5 more times, for 5 whole seconds.Question: how to execute the programme code once instead of several times.
That is, the wheel scrolled for 5 clicks, delta = dparam / 120 * 5.
Try this
I didn't check it, if anything, it's not my fault...)))))) I'll have to do something with the flag... and maybe I'll have to put the code into a custom function and mess with the flag there.
On 03 June I published my script for MT5(https://www.mql5.com/ru/code/44732).... It is still in the status of "being checked by moderator". Who knows how long to wait for checking?
Try this
I didn't check it, if it's not my fault...)))))) I'll have to mess with the flag somehow... and maybe I'll have to put the code into a custom function and mess with the flag there.
The problem is that custom functions are run only inside event functions, and I have only two such functions OnInit and OnChartEvent in my EA.
In general, I managed to do it, though not quite ace, but still better than it was.
The problem is that custom functions are run only inside event functions, and I have only two such functions OnInit and OnChartEvent in my EA.
In general, I managed to do it, although not quite a good idea, but still better than it was.
You can also call custom functions from OnChartEvent without any problems.
The flag is declared at the global level. Inserting OnTick solely to reset the flag is not a problem and will not delay code execution.
If the flag is open, a custom function is called. Internally, the flag was closed. In OnTick, the flag is opened again and waits for the next execution of the user function.
I think it's easier than getting stuck on execution time.
You can call custom functions from OnChartEvent too, no problem.
The flag is declared at the global level. Inserting OnTick solely to reset the flag is not a problem and will not delay code execution.
If the flag is open, a custom function is called. Internally, the flag was closed. In OnTick the flag is opened again and waits for the next execution of the user function.
I think it's easier than getting tied to the execution time.
I don't quite get it, or rather I don't get it at all :)
And if there are no ticks, OnTick doesn't work without ticks, what should I do?
Actually I call custom functions from OnChartEvent anyway. It was just a problem to track the last mouse click when scrolling the wheel.
The task was to delay the execution of the custom function until the moment of stopping the wheel scrolling, while counting the number of clicks during scrolling.
In principle, it worked.
On 03 June I published my script for MT5(https://www.mql5.com/ru/code/44732).... It is still in the status of "being checked by moderator". Who knows how long to wait for checking?
Just published the code. Verification took less than a minute.
Most likely you made a mistake while publishing.
Just published the code. Checking it took less than a minute.
Most likely you made a mistake when publishing it.
Tried publishing again... and it's the same thing:
under "5. Test" it says"Thetest was completed without errors" and offers to publish it, but when you click on the "Publish" button you get an error
404. This page does not exist
In the subsection "My Codes" there are now two codes and on both of them "checked by moderator".
In general, I'll ask a question in the general thread, maybe the moderators will still notice.
Tried publishing again... and it's the same thing:
under "5. Test" it says"Thetest was completed without errors" and offers to publish it, but when I click on the "Publish" button I get an error
404. This page does not exist
There are now two codes in the "My Codes" subsection and both of them have "being checked by moderator".
In general, I will ask a question in the general thread, maybe moderators will still notice.
So they see everything here. You can rest assured.