ceejay1962:
Hi,
I've written and EA that dynamically open charts and templates. The EA includes OnDeInit() which closes the open charts. This function works fine if the EA is removed manually, but doesn't get called when exiting MT5 via file->exit or 'x'. If I forget to remove the EA, I get stuck with a number of orphan charts on next startup.
Is there any technique to trigger the system to call OnDeInit() when exiting the system, or some other method?
Thanks
I don't think there is, but you could write some code in the OnInit() so when the EA restarts it repeats the clean-up process you want to invoke.
ceejay1962: I've written and EA that dynamically open charts and templates. … I get stuck with a number of orphan charts on next startup.
Don't open charts that already exist.

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,
I've written and EA that dynamically open charts and templates. The EA includes OnDeInit() which closes the open charts. This function works fine if the EA is removed manually, but doesn't get called when exiting MT5 via file->exit or 'x'. If I forget to remove the EA, I get stuck with a number of orphan charts on next startup.
Is there any technique to trigger the system to call OnDeInit() when exiting the system, or some other method?
Thanks