explorer3333:
Could anyone give me a definite answer on how MetaTrader handles concurrently running experts?

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
Hi all,
I'd like to know how MetaTrader generally handles concurrently running EAs. Let me pose a scenario to illustrate my question more thoroughly:
I have two separate Experts running on the same magic number on the same symbol, and they both have the capacity to enter a trade. My ideal case is that either one EA enters or the other, but not both. In other words, both programs will cease future entries when one program enters. I have logic to do this. My main concern is in the concurrency, that if the terminal happens to run each Expert in its own thread of execution, then one in a thousand times it will be possible for both Experts to have an entry on the same tick, bypassing the mutual-exclusion logic.
The alternative (I suppose) to having each Expert run in its own thread of execution, is that when a tick comes in the terminal runs each EAs start function in turn, eliminating any chance of concurrent entries.
It appears from my own visual tests that the Experts run one after another, but I can't verify this completely, because it could be running concurrently and just happen to appear to run one after the other.
Could anyone give me a definite answer on how MetaTrader handles concurrently running experts?