Discussing the article: "CSV Data Analysis (Part 1): CSV Export Engine for MQL5 Multi-Core Optimizations"
You don't need things like "Parallel File-Lock" at all - just send data from the agents in frames and save them into cumulative CSV-file from the single place - the terminal chart running your EA in the frame mode.
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
Check out the new article: CSV Data Analysis (Part 1): CSV Export Engine for MQL5 Multi-Core Optimizations.
Multi-core optimization in MetaTrader 5 can silently drop results when parallel agents contend for the same CSV file. A reusable MQL5 export engine applies an iteration-based spin-lock to acquire the file handle reliably and append rows without loss. It persists custom metrics such as the Sortino Ratio, average trade duration, and signal-quality measures (lag and whipsaws) into a consolidated CSV for downstream analysis.
This is the framework's central technical problem; it should be understood before reviewing the solution.
When the MetaTrader 5 Strategy Tester runs an optimization with "Use multi-core processing" enabled, it distributes individual parameter combinations across multiple parallel agent processes. Each agent runs an independent EA instance with a specific parameter set. At the conclusion of each run, OnDeinit() is called on that instance.
If the optimization spans multiple filter types or parameter ranges, several agents will reach their OnDeinit() call at approximately the same time. When multiple agents call OnDeinit() and try to open the same CSV for writing, the following occurs:
Author: Ushana Kevin Iorkumbul