The function stops an Expert Advisor and unloads it from a chart.
No return value.
The Expert Advisor is not stopped immediately as you call ExpertRemove(); just a flag to stop the EA operation is set. That is, any next event won't be processed, OnDeinit() will be called and the Expert Advisor will be unloaded and removed from the chart.
When calling ExpertRemove() in the strategy tester after successful initialization of an EA, a test is completed normally with the call of OnDeinit() and OnTester(). In this case, the entire trading statistics and an optimization criterion value are obtained, but the EA is unloaded from the test agent's memory. This means that the agent will need time to reload the EA to test the next optimization pass. Therefore, TesterStop() is a preferred option for an early routine completion of a test.