Greetings to all!

My friend and I are working on an EA. For testing & debug purposes we use FileWrite to log the events in separate .csv files for analysis.

In the test run, we run the EA concurrently on several pairs on one demo account. We found that some of the records were written in the wrong log file.

For example, some (not all) events on EURUSD were recorded in GBPUSD.csv file, whereas some events on GBPUSD were recorded on EURUSD.csv file. This happened when the EA did the same thing (e.g. placing stop orders) at the same time on the pairs. The orders were correctly placed but the log crossed each other's files. It appears they were not synchronized when written into the files.

Does anyone know how to implement the synchornization in MQL4? Does MQL4 have the same concept of synchronize like Java and C++?

Pls kindly help, thanks very much Cheers!