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?
Why do you want to force stop the backtest ?
For example I notice something wrong in Graph tab and don't want to wait for completion.
Why do you want to force stop the backtest ?
Is there some kind of callback for force stop?
For me it's unclear why OnDeinit is not called.
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.
Finally solved it by creating `keep_alive` function in dll which I execute on every tick. If keep_alive isn't executed for 1 second after last execution DLL force stops its process.
- 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 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?