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
Not necessarily every second, there is an alternative on another event there (already discussed). Please give me an example of how I did it here. ) From the condition that the Expert Advisor needs this event, but the indicator does not. It will be clearer that way.
P.S. Correction. I made a mistake. )) Your variant is not more correct. It doesn't fit at all. So it is better to give an example based on the condition above.
If the indicator does not need this event, it simply does not process it. Also, the Expert Advisor should not disable events it does not need. It can switch them on, but not switch them off. Because it is none of his business what events pass through his window and who may need them.
If the indicator does not need this event, it simply does not process it. Also, the Expert Advisor should not disable events that it does not need. He can switch them on, but not switch them off. Because it is none of his business what events pass through his window and who may need them.
The point is that this event can be unprocessed (just forget about it). But this does not mean that the event queue in the OnChartEvent() function will not be filled with things that are not needed at a certain moment.
And this means thousands of unnecessary events per minute. And if there are several programmes on the chart? Not an argument?
Much less resources are wasted if you even make a check every second to see if an event is enabled, and enable it if it is not currently enabled but is needed. Not an argument either? Then do it your way.
I don't have any more arguments. ) I'll stand by my opinion, as I haven't heard anything that can change my mind.
Good. Then I have a question for those who think that this event doesn't need to be disabled by the programme that enabled it.
Why? )
That is:
1. Why leave something that is not needed (thousands of events per minute) ?
2. (in another formulation) Why spend more resources when you can spend less ?
Options like, "if an event is not needed, just don't process it" I personally don't like at all. You can't disable one, you can't disable the other, and what will you get out of it?
Dear author of the article, you are in vain not to explain the internal contradictions of your products, which you are trying to fight and teach "beginners".
So, the author has shown the slippery moments that can upset the correct work of his indicator. Great, now it is clear to the "beginner" that:
1. Why leave what is not needed (thousands of events per minute) ?
2. (in another formulation) Why spend more resources when you can spend less ?
Options like, "if an event is not needed, just don't process it" I personally don't like at all. You can't disable one, you can't disable the other and what will you get out of it?
You will get a completely controlled code.
You emphasise performance, but does it fall so much with this enabled event? To answer this question, I have specially written a simple Expert Advisor testing this event. Having tested different combinations, I got the following table:
As you can see, the real load increases only when the actual processing of this event takes place. It is noteworthy that judging by the CPU load, MetaTrader tracks the mouse position regardless of whether the subscription to this event is enabled or not. In general, it turns out that it is pointless to save hypothetical resources, because mouse tracking will be performed anyway.
Test Expert Advisor code:
1. You should always consider the case that an event is missed on the stack. If something critical can happen in the case where an event is missed, it is very bad.
2. Customising the chart to suit yourself is bad. It is about the same as trading an automated trading machine without a magik.
Dear author of the article, you are in vain not to explain the internal contradictions of your products, which you are trying to fight and teach "beginners".
So, the author has shown the slippery moments that can upset the correct work of his indicator. Great, now it is clear to a "beginner" that:
...
You can come up with 20 more rules to justify your sense of self-importance and then you will definitely confuse yourself and "help" beginners. Contradictions and misunderstandings in this case were observed by you. )
You will get a fully controlled code.
...
It will be controlled when you control it. In this case, you propose to let everything go unchecked, i.e. to leave an event that is not needed at the moment and can be reproduced very often. On simple examples it may not be noticeable. Perhaps you will see the need to disable everything that is not needed in more complex programmes.
1. You should always consider the case that an event is missed on the stack. If something critical can happen in the case where an event is missed, it is very bad.
...
tol64:
Excuse me, am I distracting you by any chance from writing another tutorial or recipe?
If not, let's continue discussing your article about control in the indicator subwindow. So, you offer a mass solution (or an idea) how to make a convenient menu in an indicator. Good, the purpose of the article is very worthy! But how can a "beginner" programmer use all this arsenal? Where to place custom functions? Demonstrate it by example. And at the same time explain what you need to fix in the code to use, for example, 5 buttons? Consider it a beginner's question.
Like when the event queue overflows?