I have tried to successfully remove a Service from the Terminal, but failed to do so.
A Service can have (obviously) three states, "Running", "Stopped" and "Removed".
Status "Stopped" is reached when the Handler-Function OnStart() returns from execution.
Status "Running" is only valid while the OnStart() function is being executed.
Status "Removed" cannot be reached without user intervention. - Meaning, if the Service critically fails, and the Terminal is restarted, the Service will also be started again.
I assumed the function "ExpertRemove()" would do its job here, but it doesnt. The Service only goes to state "Stopped".
According t othe documentation "ExpertRemove()" only applies to Experts loaded onto a chart. - Naturally, a script calling "ExpertRemove()" will set the _StopFlag and after ending/returning from OnStart() will be auto-removed.
How could this be achieved for a Service? - Could this be considered an "insufficient" implementation in the functionality of ExpertRemove()?
I don't get what you are trying to achieve ?
Iwas refering to this context-menu, I cannot make the service "Remove" (delete) itself from the list of running services in case of (repeated) critical failure.
What I would like to do is being able to call "ExpertRemove()" inside the service and make it remove (delete) from the list of running services...
There is no difference in ExpertRemove() and returning from the handler "OnStart()". - ExpertRemove() only sets the _StopFlag to true, thats it. -
Contrary to na Expert, the call to ExpertRemove() will also remove (delete) the Expert from the list of Experts currently running.
Maybe a function called "ServiceRemove()" should be introduced, or the functionality of ExpertRemove() could be expanded to cover services as well.
Iwas refering to this context-menu, I cannot make the service "Remove" (delete) itself from the list of running services in case of (repeated) critical failure.
What I would like to do is being able to call "ExpertRemove()" inside the service and make it remove (delete) from the list of running services...
There is no difference in ExpertRemove() and returning from the handler "OnStart()". - ExpertRemove() only sets the _StopFlag to true, thats it. -
Contrary to na Expert, the call to ExpertRemove() will also remove (delete) the Expert from the list of Experts currently running.
Maybe a function called "ServiceRemove()" should be introduced, or the functionality of ExpertRemove() could be expanded to cover services as well.
I was not clear with my question, I know you want to find a way to remove the service.
What I would like to know is why ? Doesn't make much sense to me.
Do you know this: https://www.mql5.com/en/articles/11826 or the same in German: https://www.mql5.com/de/articles/11826?
It describes how a service ends: 2.4 Loading and unloading services
![MQL5 Cookbook — Services MQL5 Cookbook — Services](https://c.mql5.com/36/69/mql5-cookbook-services.jpg)
- www.mql5.com
I was not clear with my question, I know you want to find a way to remove the service.
What I would like to know is why ? Doesn't make much sense to me.
Do you know this: https://www.mql5.com/en/articles/11826 or the same in German: https://www.mql5.com/de/articles/11826?
It describes how a service ends: 2.4 Loading and unloading services
You still didn't answer but that doesn't really matter, I am just curious.
Try what 2 or 3 times, what kind of critical error.
To terminate a service you just have to return in OnStart(), like scripts, there is no really a need for a shortcut function like ExpertRemove(). If you want consistency I can ask a developper to disable ExpertRemove() in scripts and services
You still didn't answer but that doesn't really matter, I am just curious.
Try what 2 or 3 times, what kind of critical error.
To terminate a service you just have to return in OnStart(), like scripts, there is no really a need for a shortcut function like ExpertRemove(). If you want consistency I can ask a developper to disable ExpertRemove() in scripts and services
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have tried to successfully remove a Service from the Terminal, but failed to do so.
A Service can have (obviously) three states, "Running", "Stopped" and "Removed".
Status "Stopped" is reached when the Handler-Function OnStart() returns from execution.
Status "Running" is only valid while the OnStart() function is being executed.
Status "Removed" cannot be reached without user intervention. - Meaning, if the Service critically fails, and the Terminal is restarted, the Service will also be started again.
I assumed the function "ExpertRemove()" would do its job here, but it doesnt. The Service only goes to state "Stopped".
According t othe documentation "ExpertRemove()" only applies to Experts loaded onto a chart. - Naturally, a script calling "ExpertRemove()" will set the _StopFlag and after ending/returning from OnStart() will be auto-removed.
How could this be achieved for a Service? - Could this be considered an "insufficient" implementation in the functionality of ExpertRemove()?