Problem solved but I can only guess as to why the state is kept.
The solution was to reset variables, arrays and other data structures in the dll once the EA is terminated.
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 have encountered a very odd behavior of an EA in MQL4. So the EA is attached to a given chart and a UI pops us which allows the user to interact with the UI(press buttons, view stats, etc).
Once the UI is closed the EA is removed using ExpertRemove() function which then triggers DeInit and the reason code is 0 and everything is fine up to this point. If I attach the EA again to the same chart or to any other chart it basically performs all button clicks that were done the first time when the EA was attached to a chart. So I don't quite understand how and why it keeps the state of what happened in the previous run of the EA.
The UI is written in C#, there is a dll which passes data from and to Metatrader based on the user interaction.
Any idea?