debug in metaeditor doesnt open the correct expert - page 2

 
Alain Verleyen:

I should have written : IT IS an MT5 bug. I have encountered it and already opened a ticket, but it's "random" so not easy to identify and fix.

P.S: Just checked the ticket, almost 4 years 

Selected EA in Strategy Tester change when recompile.

Errors, MetaTrader 5 Client, Open, Start: 2013.03.13 20:59, #692492 

I am facing the same error in build 2485, from year 2020, so 7 years since initial ticket. Sounds like the bug persists. It is a ramdom error, it's back worked after some restarts.
 
rafaleo:
I am facing the same error in build 2485, from year 2020, so 7 years since initial ticket. Sounds like the bug persists. It is a ramdom error, it's back worked after some restarts.
To fix it you need to have a way to reproduce it. It could last forever.
 

I have the very same problem.Sometimes it opens the file you are working at metaeditor, sometimes it does not

I tried to reproduce the conditions when it works but could not find a common cause.

It is too bad as it does not allow you to debug your code.

The folks at Metatrader5 should work on this!

 

I have been trying a workaround that seems to be working
I open a new Expert Advisor file (with a new name), clear all lines and copy to it the contents of the one I am trying to debug

Then, after compiling, when you open the debug the tester will work on it.

If someone tries this and work, please inform

Good luck!

 

The solution to this

Always open the metaeditor file that you are willing to debug from the metatrader Navigator.

If the file does not show there, it needs to be compiled (from the proper MQL5 directories - expert or indicators).

Once compiled it will show on the navigator.

Now you close the file on the metaeditor and then open it from the metatrader navigator, right clicking on modify.

The file will now open in metaeditor and u can properly debug it.

Hope this helps