
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
Yedelkin:
Explanation. If an Expert Advisor does not process ticks for a symbol to which it is attached to a chart, the continuous generation ofNewTick events for this symbol will lead to an overflow of the queue of events processed by this EA.
What do you mean?
There is no OnTick() in the Expert Advisor, but NewTick events become queued?
How do you know what analyzed the queue? )
Couldn't find a way to disable the tick stream (NewTick event) for the symbol with the Expert Advisor attached to the chart, if necessary.
I feel that I have worked from Sunday till Friday without any rest... :))
What do you mean?
How did you know...?
I learned it in two ways. First I got acquainted with the EventChartCustom - OnChartEvent combination on the example of a simple Expert Advisor collecting indicator signals from foreign symbols. At the same time, the Expert Advisor did not work with the ticks of its own symbol, the Ontick() function in the code of the Expert Advisor was commented out. When running the EA in the tester, I found that the travel time differs depending on which symbol is attached to the EA. See, for example, the example below. With the same optimization parameters the pass times are noticeably different.
Expert Advisor has no OnTick(), while NewTick events are queued?
To check the answer to this question (the second method), I modified the Expert Advisor's code in the following way
i.e. I inserted a line with yellow background, in order to detect the fact of new ticks receipt by the symbol. The results show that the ticks for the symbol, to which the Expert Advisor is attached, are received regularly:Well, since the handbook says " NewTick event is generated when a new tick is received by a symbol, to the chart of which the Expert Advisor is attached", the fact that new ticks are received should cause theNewTick event to be generated.
Judging by your question, you think that no NewTick events are generated when OnTick() is disabled? But I did not find such information in the handbook.
It feels like you worked from Sunday to Friday with no rest... :))
i.e. I inserted a line highlighted in yellow background to detect the fact of new ticks coming in by symbol. From the results you can see that the ticks by
to the symbol to which the Expert Advisor is attached are received regularly:
did you check which event causes OnChartEvent to be called before you call the custom one ?
-------------
if
you put in a simple EA and let it run in the tester, it doesn't activate.
do you have other functions that call OnChartEvent ?
do you have other functions that call OnChartEvent.
Yes, of course. Since the Expert Advisor collects indicator signals from third-party symbols using the EventChartCustom - OnChartEvent binding, each such indicator has its own instance of the EventChartCustom() function. The first parameter of each instance of the EventChartCustom() function contains a chart identifier, to which our EA is attached; the second parameter is zero.
If inserted in any Expert Advisor, it will not be activated.
This is only a part of the code, - from the Expert Advisor that collects indicator signals from other symbols. If there are no indicators, this part of the code (the OnChartEvent function) will not process the custom events due to their absence.
have you checked which event causes OnChartEvent to be called before you call the custom event?
No, a bit wrong. I wanted to see if the ticks are received by the symbol, to the chart of which the Expert Advisor is attached, when the OnChartEvent() function processes the custom events coming from the indicators from other symbols. It can be seen that EURGBP ticks are received. Based on the reference, I conclude that when new ticks come for the symbol,the NewTick event is generated.
It is not possible to figure out which of your functions you used led to different timing results. Without complete code, it's just guessing by coffee grounds.
NewTick is not directly related to OnChartEvent in any way. That's why the queue tracking mechanism you suggest is rather artificial. I am not sure that it is correct.
In this case I would not claim that it is NewTick that creates the test delays. And I think it's the mechanisms of your bindings that are to blame, not the event itself.
It is not possible to figure out which of your functions you used led to different timing results. Without complete code, it's just guessing by coffee grounds.
NewTick is not directly related to OnChartEvent in any way. That's why the queue tracking mechanism you suggest is rather artificial. I am not sure that it is correct.
In this case I would not claim that it is NewTick that creates the test delays. And I think it's your bindings mechanisms that are to blame, not the event itself.
The matter was not what I meant from the very beginning. In my first message, I said that I had not found a way to disable tick events for a symbol with an Expert Advisor attached to its chart. You have reacted to that phrase, but you have not provided a way to disable the flow of ticks for the required symbol, if necessary. I conclude that not only I, but you also do not know such a way. So my suggestion still stands: introduce a toggle function that allows you to programmatically disable the event generation NewTickfor the symbol that has an Expert Advisor attached to its chart.
As for comments about "guessing by gee" and "artificiality of queue tracking mechanisms" - I didn't offer to look into the code from the very beginning and seek an answer to the question "why is it so? As you can see from my suggestion, I have already found the answer for myself. But let's consider the problem from a more abstract point of view, without focusing our attention on the code of a particular Expert Advisor.
NewTick is in no way connected directly with OnChartEvent.
Okay, let's assume that it is. So, NewTick isindirectly related to OnChartEvent, but it is connected. I have already said it in the explanation but I will repeat it once again. You know better than I do that there is some "common queue of events" where all the occurring events are piled up, both predefined and user-defined. These events are handled one by one, in the order they are received. Since the queue has some limited size, when it is full, old events are removed without being processed. Is that right?
So, it turns out that if the Expert Advisor does not provide for handling NewTick events, but these events are still generated, then my general queue of events will be simply clogged with unnecessary NewTick events, and there will be a risk of not handling obsolescent user events that must be handled by Expert Advisor. I hope you agree with this conclusion. That's why I made the above suggestion.
Of course, I do not know all the subtleties of how the event queue and NewTick event work. Therefore, I may be wrong in some conclusions and will consider any explanations with interest.
In this case I would not claim that it is NewTick that creates test delays. And I think it's the mechanisms of your bindings that are to blame, not the event itself.
For reference. The Expert Advisor hinges the instances of one and the same indicator with the same parameters and with the same "binding mechanism" on the adjacent symbols, on one and the same time interval. The binding is the same: EventChartCustom - OnChartEvent.
Did I understand correctly that you agree with statement that "if there is no OnTick() in an Expert Advisor, the NewTick events are not queued at all"?
Why guess and make up hypotheses?
your request to"introduce a switch function that allows you to programmatically disable event generation NewTickfor the symbol to which the Expert Advisor is attached to the chart. " is clear.
Write to servicedesk.
everything else is fighting windmills.
Why guess and concoct hypotheses?
everything else is a struggle against windmills.
You don't say :) Some are used to working blindly, while others seek to learn more about the phenomenon to be curbed. Hypotheses arise in the absence of this or that information. Thanks for taking part in the discussion.
I wrote to the SD. I did not know that suggestions could be addressed there.