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
And the fact that "button functions are placed in the OnInit function" is very funny!
However, maybe you don't understand what we are talking about? If you press a button, some user function should be triggered, which will perform some micro-task.
All right, let's have a laugh. The article was written by you, "nobody pulled your tongue".
So, the explanation in the form of quotations for the unexplainable is at least disrespectful to your readers. Questions should be answered with examples and links to primary sources.
Confusing and overloaded code with unnecessary functions only misleads "beginners".
And the fact that "button functions are placed in the OnInit function" is very funny!
Nobody pulled you by your tongue. Are you going to give me proofs? Or rather, a refutation of my statement? For your information, not everything is described in the Handbook yet. I mean, work on the handbook is in progress, additions and corrections are being made. You should always check everything yourself.
Believe me, the code from your article is much more "confusing" for beginners and not only, which can be seen in the discussion of your article.
However, maybe you do not understand what we are talking about? If you click on a button, some user function should be triggered to perform some micro-task.
Yes, I took it literally. Ask your questions more precisely. But I anticipate that my answer will be ridiculed by you, since you seem to have such a function today.
In this case the "microtask" was to change the colour of the button. I purposely didn't add any extra features so as not to have anything superfluous. Just to avoid overloading the code.
Actually, the topic of the article is not limited only to buttons. Most of it is about chart events. There are few such examples, so I decided to write one.
Dear author of the article, you wrote it not for me, but for beginners. Indeed, I am not interested in your solutions, but we are talking about those who are just getting to know the language. What "other programs" are we talking about? And how can the OnDeinit function of one program affect the functions of other programs?
We are discussing an article and what are you so indignant about?
Try to answer the questions not for me, but for beginners - so that they understand why and how.
Dear author of the article, you did not write it for me, but for beginners.
Exactly so.
Indeed, I am not interested in your solutions, but we are talking about those who are just getting to know the language.
But you ask questions.
What "other programmes" are we talking about?
The very ones you gave links to before. And you try to refute my statement by hints without giving a proof.
And how can the OnDeinit function of one program affect the functions of other programs?
It does. I wrote about it. The editor who published the article confirmed it. You can also check it and see for yourself.
We are discussing the article and what do you resent so much?
Nothing. I'm waiting for a rebuttal to my assertion. )
Try to answer questions not for me, but for newcomers - so that they understand why and how.
There have been no questions from newcomers so far. And there can be no questions. Everything is very clear and every line of code is commented in detail.
We jam this first:
i.e. now we don't track mouse events, right?
Run your code on the chart:
now we run "another programme", let it be your code again:
I guess something went wrong? Or is that what we're supposed to do?
now we delete one of the indicators and according to the author of the code we have lost "mouse tracking", but it does not happen:
If you don't qualify, then I don't know who does? Danald Knuth? Bill Gates?
I was just trying to get a compliment. It worked.)
I see. But what is not clear is that the leading products of the Market created by you do not belong to you. Isn't that a shame?
1. It's not evening yet)
2. My handicraft is also constantly in the top, although it is not in any comparison with the panel.
3. The success of the panel is largely due to the efforts of the author of the idea, so it is incorrect to say that it is my product.
4. I did not work for free)
...
now we delete one of the indicators and according to the author of the code we have lost "mouse tracking", but this does not happen:
Now check if the OnDeinit() event is triggered in the indicators. This is the interesting point I mentioned before. :) Namely in OnDeinit(), in the example from the article, the motion tracking event is disabled. Since some build it seems that OnDeinit() has stopped working in indicators at all. This is a bug and we should inform the developers.
Further, to make sure that my statement is correct, we need to make a blank Expert Advisor (the OnDeinit() function works in Expert Advisors), in which it is enough to add this line of code (highlighted):
//---
And now, if you remove the Expert Advisor when the indicator from the article is on the chart, the tracking of the movement event will be disabled in the indicator as well.
About this one:
something must have gone wrong? Or is this the way it is designed?
It is known. It is not designed that way, it is just not taken into account in this article. The article, as always, is a simple example, not a ready-made solution for all cases. )
In general, this code seems to be very problematic. There is no real reason to switch off mouse movement tracking when disabling the Expert Advisor/indicator. If you want to bother so much, you should restore the state that existed before the Expert Advisor was initiated:
In general, this code seems to be quite problematic. There is no real reason to switch off mouse movement tracking when disabling the Expert Advisor/indicator.
No, you are wrong. There are real reasons to disable mouse tracking. And I will prove it now. )
For example, you have two programs running on a chart. The Expert Advisor, in which you need to track the mouse movement event. And an indicator in which you do not need to track the mouse movement event, but you need to track some other chart events.
Now run this code of the Expert Advisor:
In it, during initialisation, in the OnInit() function, tracking of the mouse movement event is enabled. But the line in the OnDeinit() function, where this tracking should be disabled, is intentionally commented out.
Load the indicator on the chart as well. Here is its code:
Both the first and the second programme prints a message to the log that the event is received. Now remove the Expert Advisor from the chart. Let's assume that you have made some calculations with its help and you don't need it anymore. After its removal, since the mouse movement tracking event has not been disabled, the indicator continues to receive this event. And you don't need it.
Do you agree now? )