Discussing the article: "Building a Research-Grounded Grid EA in MQL5: Why Most Grid EAs Fail and What Taranto Proved"
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: Building a Research-Grounded Grid EA in MQL5: Why Most Grid EAs Fail and What Taranto Proved.
This article implements a regime-adaptive grid trading EA based on the PhD research of Aldo Taranto. It presents a regime‑adaptive grid trading EA that constrains risk through restartable cycles and equity‑based safeguards. We explain why naive grids fail (variance growth and almost‑sure ruin), derive the loss formula for real‑time exposure, and implement regime‑aware gating, ATR‑dynamic spacing, and a live kill switch. Readers get the mathematical tools and production patterns needed to build, test, and operate a constrained grid safely.
In MQL5, there are several ways to store data, such as using files, input parameters, or static/global variables in memory. For this implementation, however, we use a global variable of the terminal. These are special key-value pairs stored by the trading terminal itself.
They have important properties that make them good for storing critical runtime state: they persist even after a terminal restart, remain accessible across EA reloads, and do not require complex file handling.
What must be stored?
To fully recover a system after a restart, we must store three critical aspects: whether trades are suspended, which trades are affected, and the original stop-loss (SL) and take-profit (TP) values of the trade. Without all three, recovery will be incomplete.
For each trade whose stops have been suspended, we must preserve three pieces of data:
We also store the number of suspended trades and a flag that indicates an active suspension cycle (though this can be deduced from the saved data).
Author: Muhammad Minhas Qamar