How To Write Some Output To The File Before Crash ?

 

I'm trying to make a new EA with recursive function and every time I back tested it, its always " Meta Trader has stopped working ".

I don't know in which part is the problem.

I put some of print statements for debugging but I couldn't see it because it crashed.

I also couldn't find some output in the tester directory, usually all of the print() output would go there if Meta Trader didn't crash.

Also, is this cause by infinite loop or run out of memory or can be other reasons ?

 
Your recursion is very dangerous, takes up all the processing power of the CPU. You must stop it somewhere.
 
mideel:

I'm trying to make a new EA with recursive function and every time I back tested it, its always " Meta Trader has stopped working ".

I don't know in which part is the problem.

I put some of print statements for debugging but I couldn't see it because it crashed.

I also couldn't find some output in the tester directory, usually all of the print() output would go there if Meta Trader didn't crash.

Also, is this cause by infinite loop or run out of memory or can be other reasons ?

Instead of the Print statement, You may send the log to a custom text file and flush it after every write. This is the way I create trace logs to isolate a problem.

Or you may use and catch the standard Windows debug output https://www.mql5.com/en/forum/150558

 

Why don't you write it in the Comment(..).

If you EA stops working without disappearing from your screen you can see what the EA has done last.

Beside that I guess you have an endless loop by e.g. not changing the checked(?) variable..

Reason: