MetaTrader Daily Loss Limits Can Reset on Restart, Exposing Prop Traders to Risk

A common flaw in MetaTrader 5 Expert Advisors causes daily loss limit variables to reset to zero whenever the terminal restarts, is recompiled, or a chart is reloaded. This happens because the guard state is stored only in memory, which is wiped on every OnInit() call. The bug is particularly dangerous for prop-firm traders subject to strict daily drawdown rules, since terminal crashes tend to cluster on volatile, loss-heavy days when the protection is needed most. Developers recommend persisting guard state to disk or terminal globals, using broker server time rather than local time, and writing state before sending any order to prevent race conditions. Since MQL5 offers no cross-program order hook, robust risk control may ultimately need to be implemented outside the terminal entirely.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in