I am using sqlite database in my EA.
When I force stop backtest process agent hangs and never accepts new jobs until I restart MetaTrader.
I figured out that after force stop agent still keeps sqlite database file open. I've added file release in both OnDeinit and in destructor of database operations class but they fire only on regular backtest end or ExpertRemove. OnDeinit nor destructor are being called on force backtest stop. Is there any way to handle force stop I EA code?
Is there some kind of callback for force stop?
For me it's unclear why OnDeinit is not called.
Because a forced stop is a forced stop, nothing is called, you have to deal with it.
If you want to have control, you need to check your "stop conditions" in your code and use ExpertRemove() or TesterStop().
Eventually find an other way to release your sqlite file, or an other way to "force stop" your backtest.