bool _StopFlag
The _StopFlag variable contains the flag of the mql5-program stop. When the client terminal is trying to stop the program, it sets the _StopFlag variable to true.
To check the state of the _StopFlag you may also use the IsStopped function.