Download MetaTrader 5
To add comments, please log in or register
Are you accustomed to using the standard library? MQL5 has one!
Mideel
74
Mideel 2015.01.18 14:07 

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 ?

Peter Bočan
89
Peter Bočan 2015.01.18 14:12  
Your recursion is very dangerous, takes up all the processing power of the CPU. You must stop it somewhere.
Halley
198
Halley 2015.01.18 14:37  
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

Carl Schreiber
5960
Carl Schreiber 2015.01.18 17:58  

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..

/
To add comments, please log in or register