how to detach EA from within EA code

 
Hello,
i need to have an EA, which is capable to unload itself from code.
how to do this please ?
 
hurgax:
i need to have an EA, which is capable to unload itself from code.
how to do this please ?

This gets asked a lot, e.g. https://www.mql5.com/en/forum/121374. The usual response is "why do you need the EA to unload itself, rather than just keep running but not trade?"

 
jjc:

This gets asked a lot, e.g. https://www.mql5.com/en/forum/121374. The usual response is "why do you need the EA to unload itself, rather than just keep running but not trade?"


Hello thanks, i read this thread but had the hope there is may a solution meanwhile.

"why do you need the EA to unload itself, rather than just keep running but not trade?"
Because a detached EA singals users "EA finished".
In comparison to a script, an EA is updated only if something happens in chart.
Also access to market data is smarter and an EA can also be detached by user.

My question is: what is the problem to provide such a detach function ??
What is the difference between calling deinit initiated from UI and initiated from within script ?
 
hurgax:
Hello thanks, i read this thread but had the hope there is may a solution meanwhile.

The thread jjc suggested has the solution. It can be done via WinAPI call, read this again -> https://www.mql5.com/en/forum/121374.

 
gordon:

The thread jjc suggested has the solution. It can be done via WinAPI call, read this again -> https://www.mql5.com/en/forum/121374.


i am sorry. thank you. this works.
 
hurgax wrote >>


i am sorry. thank you. this works.


My thanks too

If (EALivetest()==LostTooMuch() ) commitSuicide() ;
Reason: