Build 772, OnDeinit()

 

Why is the function "OnDeinit(...)" of an Expert Advisor in the new Build -  772 - not executed?  Some problem? 

 
JMRodMartins:

Why is the function "OnDeinit(...)" of an Expert Advisor in the new Build -  772 - not executed?  Some problem? 

It's been reported here too:  https://www.mql5.com/en/forum/10793
Comment ("") does not works in indicator OnDeinit
Comment ("") does not works in indicator OnDeinit
  • www.mql5.com
So we still see its comment and text lefted int the chart but the indicator have been removed.
 

RaptorUK:
It's been reported here too:  https://www.mql5.com/en/forum/10793

It's no answer. "OnDeinit()" must work. With Build 770 didn't work too. Without "OnDeinit()" you can't clean the chart when you remove an indicator or an expert advisor (as reported  in the comment

10793, as you  said), but also you can't delete some dynamic pointer you have used in the Expert Advisor, and you get a memory leak!

 
JMRodMartins:

It's no answer. "OnDeinit()" must work. With Build 770 didn't work too. Without "OnDeinit()" you can't clean the chart when you remove an indicator or an expert advisor (as reported  in the comment

10793, as you  said), but also you can't delete some dynamic pointer you have used in the Expert Advisor, and you get a memory leak!

I have an Indicator that has a working OnDeinit() in build 770,  I know it works because the Objects I placed on the chart are removed when I remove the Indicator.  

 

Perhaps it's another UAC issue,  what Operating System are you using ?  and what folder do you have MT5 installed in ? 

 
"RaptorUK:

I have an Indicator that has a working OnDeinit() in build 770,  I know it works because the Objects I placed on the chart are removed when I remove the Indicator.  

 

Perhaps it's another UAC issue,  what Operating System are you using ?  and what folder do you have MT5 installed in ? "

 

My problem are the Expert Advisors; when I remove them ( or they finish testing on the Strategy Tester ), the objects are not removed and the memory for the dynamic pointers is not deleted.

My OS is Windows 7. MT5 ("terminal.exe") is installed in C:\Programms\MetaTrader5. The EAs are in C:\User\...\AppData\Roaming\MetaQuotes\Terminal\...\MQL5\Experts. I find it's a problem with

the MT5 Builds, because the OnDeinit() of the Expert Advisors was sooner executed properly. (the UAC is disabled).

 

Try to recompile source in 772 build.

int OnInit()
  {
   Print("Init");
   return(0);
  }
void OnDeinit(const int reason)
  {
   Print("Deinit");
  }
void OnTick()
  {
   Print("Tick");
  }

Journal:

2013.02.21 23:50:44     Empty (GBPUSD,H1)       Deinit
2013.02.21 23:50:43     Empty (GBPUSD,H1)       Tick
2013.02.21 23:50:42     Empty (GBPUSD,H1)       Tick
2013.02.21 23:50:38     Empty (GBPUSD,H1)       Tick
2013.02.21 23:50:38     Empty (GBPUSD,H1)       Init


 
Renat:

Try to recompile source in 772 build.

Journal:


 In a new MQ Demo account (with Build 772) is now every file under the programm folder  (C:\Programms\MetaTrader5), and OnDeinit() of the Expert Advisors (after new compiling) is now also properly executed! Thanks!  

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 
JMRodMartins:

 In a new MQ Demo account (with Build 772) is now every file under the programm folder  (C:\Programms\MetaTrader5), and OnDeinit() of the Expert Advisors (after new compiling) is now also properly executed! Thanks!  

It was most probably a UAC issue so installing in  C:\Programms\MetaTrader5\  was probably what fixed the issue.

If anyone else wants to try Renat's test code here it is:

 

Files: