Release file on force backtest stop

To add comments, please log in or register
alter-ego
18
alter-ego  

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?

Alain Verleyen
38275
Alain Verleyen  
alter-ego:

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 ?
alter-ego
18
alter-ego  
Alain Verleyen:
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.
alter-ego
18
alter-ego  
alter-ego:
For example I notice something wrong in Graph tab and don't want to wait for completion.
Alain Verleyen:
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.

Alain Verleyen
38275
Alain Verleyen  
alter-ego:

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.

alter-ego
18
alter-ego  
By force stop I mean pressing “stop” button in terminal. Why this kind of stop does not call OnDeinit?
To add comments, please log in or register