Only between different programs (EAs, indicators, scripts).
An event is added to the queue only once and will run in the order queued, as soon as the current function returns. Additional ticks are ignored, because OnTick event is already in the queue when OnTick is running.
The queue is used for OnTick, OnTimer, ChartApplyTemplate, ChartIndicatorDelete, ChartNavigate, ChartOpen, ChartScreenShot, ChartSet…, object….
A program gets events only from the chart it is running on. All events are handled one after another in the order of their receipt. If the queue already contains the NewTick event or this event is in the processing stage, then the new NewTick event is not added to mql5 application queue. Similarly, if the ChartEvent is already in an mql5 program queue or such an event is being handled, then a new event of this type is not placed into a queue. Timer event handling is processed in the same way — if the Timer event is already in the queue or is being handled, no new timer event is set into a queue.
Event queues have a limited but sufficient size, so the queue overflow is unlikely for a correctly developed program. When the queue overflows, new events are discarded without being set into a queue.
Event Handling - MQL4 Reference
Only between different programs (EAs, indicators, scripts).
An event is added to the queue only once and will run in the order queued, as soon as the current function returns. Additional ticks are ignored, because OnTick event is already in the queue when OnTick is running.
The queue is used for OnTick, OnTimer, ChartApplyTemplate, ChartIndicatorDelete, ChartNavigate, ChartOpen, ChartScreenShot, ChartSet…, object….
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Within my EA OnTimer() and OnTradeTransaction(...) have read and write access to the same array. Do I need to take care about thread safeness and if so how can I achieve it in MQL5?
Thanks in advance!