Terminating an Expert

 
How can you make an expert end from within it own code?
 
Divide by zero ? .. doesn't detach it from the chart, though.
 
inbhm:
How can you make an expert end from within it own code?
There is no way to do so I'm afraid.
You can stop it working though.
bool Stop;
 
int init()
{
    Stop = false;
}
 
int start()
{
    if (Stop)
        return (0);
 
// EA code here
 
// if something happens that has to stop the EA...
    Stop = true;
    return (0);
 
}
 
You might want to put the Stop in a globalvar, cause the thing that stopped the ea might change in the next execution or something...and it could start up again. .
Reason: