Is There a Way Around that

 

ok so I'm explorating and migrating to MT5 because it is so much superiror but I got issues obviously.

one of them being I write some stuff in a text file in my EA, the problem is that if I stop backtesting early, it somewhat doesn't close the handle of the text file, even if I call it in the DeInit() function

so apparently when I stop the backtest of a robot in the strategy Tester, it doesn't run the DeInit() function ?

if so, how to properly close the handle of the txt file in case of emergency backtest stop ?

or is it just not possible?


thanks so much


Jeff

 
Of course it does, what makes you think otherwise?
 
lippmaje:
Of course it does, what makes you think otherwise?

my filehandle isn't closed, but I close it in the deinit.

I must have made an error somewhere

will investigate

thanks

Jeff

 
lippmaje:
Of course it does, what makes you think otherwise?

ok so I tested and the DeInit() function is definitively NOT called when I stop the backtest early.


So... I think this is not good at all...


is there a solution to that ? is it some kind of bug ?

 
You are right, it's not called when the test gets aborted by the user. No idea about a workaround, though, the stop flag won't work in this case.
 
Jean Francois Le Bas:

if so, how to properly close the handle of the txt file in case of emergency backtest stop ?

The testing process is terminated forcefully (like with taskkill on Windows resp kill on Unix). There's no handler you could get to run upon this event. However, all open file handles will be closed by the system.

Reason: