MT4 Chart Events: Queued??

 
Hi All

This is very very hard to test and I can't seem to find any documentation on it.

I'm wondering if ChartEvents are queued (synchronous) or are asynchronous? For example, lets say I have two indicators which are sending custom chart events to a third indicator. If the first 2 indicators send a custom event to the 3rd chart at exactly, or nearly exactly the same time, what happens when the 3rd indicator attempts to process the events? Will it process the first event, then have the 2nd event waiting in the queue to process? Or will the 2nd event have disappeared during the time it takes to process the first event? Just like you can miss a Tick if still processing OnTick when the 2nd tick arrives.

Any ideas or documentation that anyone knows of?

Cheers
Stu
 

It's on this page :

Similarly, if ChartEvent is already enqueued, or this event is being processed, no new event of this kind is enqueued.

 
Alain Verleyen:

It's on this page :

Champion, thanks Alain :) Looks like I'll need to set an acknowledge message and resend if not acknowledged 
 
Stuart Browne:
Champion, thanks Alain :) Looks like I'll need to set an acknowledge message and resend if not acknowledged 
If you talk about firing custom events rather than the UI chart events, then they seem to be executed immediately, i.e. like calling a function. So you probably do not need any handshake.
 
Ovo Cz:
If you talk about firing custom events rather than the UI chart events, then they seem to be executed immediately, i.e. like calling a function. So you probably do not need any handshake.
The custom event can only be executed immediately if it's the same thread. So it depends of the usage.
 
Thanks guys. Yeah my problem arises as I could have up to 5 charts firing custom events to one chart at the same time, so there is a chance, however slight, that 2 could collide and I'd miss one. So I think a handshake would be the safest, though a lot more coding
 
Stuart Browne:
Thanks guys. Yeah my problem arises as I could have up to 5 charts firing custom events to one chart at the same time, so there is a chance, however slight, that 2 could collide and I'd miss one. So I think a handshake would be the safest, though a lot more coding
In the thread above you talked about indicators, and they run in a single thread. But you may still use the handshake to ensure the other party is listening.
 
Ovo Cz:
In the thread above you talked about indicators, and they run in a single thread. But you may still use the handshake to ensure the other party is listening.

Not all indicators are running in the same thread, only if it's the same symbol.

EDIT: It's for MT5, seems it's different for MT4, so you are probably right.

Program Running - MQL4 programs - MQL4 Reference
Program Running - MQL4 programs - MQL4 Reference
  • docs.mql4.com
Program Running - MQL4 programs - MQL4 Reference
 
Ovo Cz:
In the thread above you talked about indicators, and they run in a single thread. But you may still use the handshake to ensure the other party is listening.
Yeah sorry, my fault, bad example. They're actually EAs so are running in separate threads. I think I've decided to go with using the custom events to fire the message and globals to ack.
Reason: