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?
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.
OE 0 Tester 15:35:25 Experts\Ye00-01-0 Event.ex5 on USDRUR,M1 from2010.08.0100:00 to 2010.08.0900:00 CH 0 Tester 15:35:25 complete optimization started
LO 0 Core 115:35:25 agent process started
HK 0 Core 115:35:25 connecting to 127.0.0.1:3000
OK 0 Core 215:35:25 agent process started
DO 0 Core 215:35:25 connecting to 127.0.0.1:3001
DG 0 Core 215:35:26 connected
EK 0 Core 115:35:26 connected
NQ 0 Core 115:35:26 authorized (agent build 384)
QK 0 Core 215:35:26 authorized (agent build 384)
DI 0 Core 115:35:26 pass 0 started
LM 0 Core 215:35:26 pass 1 started
QK 0 Core 115:35:27 common synchronization completed
FD 0 Core 215:35:27 common synchronization completed
GR 0 Core 215:36:08 pass 1 returned result 10000.00in42 sec
RH 0 Core 215:36:08 pass 2 started
ON 0 Core 115:36:09 pass 0 returned result 10000.00in43 sec
ID 0 Core 115:36:09 pass 3 started
GK 0 Core 215:36:21 pass 2 returned result 10000.00in13 sec
QQ 0 Core 215:36:21 pass 4 started
PH 0 Core 115:36:21 pass 3 returned result 10000.00in12 sec
IR 0 Core 115:36:21 pass 5 started
ED 0 Core 215:36:34 pass 4 returned result 10000.00in13 sec
ON 0 Core 215:36:34 pass 6 started
MQ 0 Core 115:36:34 pass 5 returned result 10000.00in13 sec
GK 0 Core 115:36:34 pass 7 started
KN 0 Core 215:36:46 pass 6 returned result 10000.00in12 sec
ND 0 Core 215:36:46 pass 8 started
CJ 0 Core 115:36:47 pass 7 returned result 10000.00in13 sec
EP 0 Core 115:36:47 pass 9 started
PG 0 Core 215:36:59 pass 8 returned result 10000.00in13 sec
QO 0 Core 115:36:59 pass 9 returned result 10000.00in12 sec
MD 0 Tester 15:36:59 optimization finished, total passes 10
HS 0 Tester 15:36:59 optimization passed in1 minutes 34 seconds
CE 0 Core 115:36:59 connect closed
PI 0 Core 215:36:59 connect closed
ON 1 Tester 15:37:20 genetics turned off because 10 passes, to use genetics increase amount of optimized parameters
RQ 0 Tester 15:37:20 Experts\Ye00-01-0 Event.ex5 on EURGBP,M1 from2010.08.0100:00 to 2010.08.0900:00 FL 0 Tester 15:37:20 complete optimization started
QM 0 Core 115:37:20 connecting to 127.0.0.1:3000
MG 0 Core 215:37:20 connecting to 127.0.0.1:3001
MN 0 Core 115:37:20 connected
LR 0 Core 215:37:20 connected
FH 0 Core 115:37:20 authorized (agent build 384)
QR 0 Core 215:37:20 authorized (agent build 384)
DF 0 Core 115:37:20 pass 0 started
LJ 0 Core 215:37:20 pass 1 started
JR 0 Core 115:37:20 common synchronization completed
EK 0 Core 215:37:20 common synchronization completed
IK 0 Core 115:38:35 pass 0 returned result 10000.00in75 sec
KQ 0 Core 115:38:35 pass 2 started
QG 0 Core 215:38:36 pass 1 returned result 10000.00in76 sec
FM 0 Core 215:38:36 pass 3 started
JD 0 Core 115:39:16 pass 2 returned result 10000.00in41 sec
MN 0 Core 115:39:16 pass 4 started
QP 0 Core 215:39:17 pass 3 returned result 10000.00in41 sec
FJ 0 Core 215:39:17 pass 5 started
KM 0 Core 115:39:56 pass 4 returned result 10000.00in40 sec
CG 0 Core 115:39:56 pass 6 started
DJ 0 Core 215:39:57 pass 5 returned result 10000.00in40 sec
LP 0 Core 215:39:57 pass 7 started
IF 0 Core 115:40:37 pass 6 returned result 10000.00in41 sec
FL 0 Core 115:40:37 pass 8 started
DS 0 Core 215:40:38 pass 7 returned result 10000.00in41 sec
GI 0 Core 215:40:38 pass 9 started
KP 0 Core 115:41:18 pass 8 returned result 10000.00in41 sec
NH 0 Core 215:41:19 pass 9 returned result 10000.00in41 sec
MS 0 Tester 15:41:19 optimization finished, total passes 10
OJ 0 Tester 15:41:19 optimization passed in3 minutes 59 seconds
komposter:
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
voidOnChartEvent(constint id, // идентификатор события constlong& lparam, // параметр события типа longconstdouble& dparam, // параметр события типа doubleconststring& sparam // параметр события типа string
)
{
EventChartCustom(ChartID(),0,(long)SymbolInfoInteger(_Symbol,SYMBOL_TIME),0,_Symbol);
if(id==CHARTEVENT_CUSTOM) Print(__FILE__," ",__FUNCTION__,": ",sparam ," ",(datetime)lparam);
}
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.
Yedelkin: 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
voidOnChartEvent(constint id, // идентификатор события constlong& lparam, // параметр события типа longconstdouble& dparam, // параметр события типа doubleconststring& sparam // параметр события типа string
)
{
EventChartCustom(ChartID(),0,(long)SymbolInfoInteger(_Symbol,SYMBOL_TIME),0,_Symbol);
if(id==CHARTEVENT_CUSTOM) Print(__FILE__," ",__FUNCTION__,": ",sparam ," ",(datetime)lparam);
}
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.
sergeev:
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.
sergeev:
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.
sergeev:
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.
sergeev:
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"?
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.
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.
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.