• Sign up >>

Dose it posible to creat any function of "mql code" posting in this forum? - page 3

To add comments, please log in or register
Sergey Golubev
Moderator
114720
Sergey Golubev  
Sergey Golubev
Moderator
114720
Sergey Golubev
Moderator
114720
Sergey Golubev  

And this post about how to find/fix zero devide: https://www.mql5.com/en/forum/general

Sergey Golubev
Moderator
114720
Sergey Golubev  

If broker added one more digit?

https://www.mql5.com/en/forum/179191

Sergey Golubev
Moderator
114720
Sergey Golubev  
Sergey Golubev
Moderator
114720
Sergey Golubev  
Cassio Jandir Pagnoncelli
10
Cassio Jandir Pagnoncelli  

Uncommonly error

Hi folks,

I have been coding a EA, and I faced a uncommonly error. So, I'd like to ask your help with this error on MT4, which I believe some of you, in all your experience, may already have faced the same.

Reading the entire EA may be impractical, source code is very large.

After successful compilation, in the tester, MT4 journal tells the following error

Time: 2011.01.28 23:35:36

Message: 2007.07.13 00:00 InterCandles EURUSDFXF,H4: stack overflow.

Even raising stack size to heavens via

#property stacksize 167692160

which, I believe, allocates 16MB of memory, the error endures.

Did anyone faced the same problem of "stack overflow" in the tester, or can point out whether the problem is MT4 internal, or in the EA (possibly in array, nested declarations, too large ex4 file, etc)?

I appreciate your helping hand and I am sorry for taking your time.

Thank you.

Cassio Jandir Pagnoncelli
10
Cassio Jandir Pagnoncelli  

Solution of the problem

Well, before someone reply, I found the solution.

Before using the function, just after tester loads the EA --which links the library attached--, the message "stack overflow" is shown in journal.

Problem found with the function named "power", in the attached file. My conclusions are the following:

1) Certainly there is no problem with its name; no MQL function collision in symbol table of the EX4. Other labels were tested.

2) Apparently no limit of functions was reached. More functions were added after removing the problematic function and error did not occurred. Works properly only by removing this function, not only unlinking in the EX4 file through the MT4 compiler.

3) Recursion is executed via many calling and results are left in the stack. Stack grows linearly asymptotically as argument `exponent' exponentially grows. Potentially, stack may reach its limit and go on overflow. The "stack overflow" error appears independently of the execution of this function.

Therefore, I induce MT4 compiler may have a device detecting [some classes of] recursion which are not allowed in the language avoiding potential stack overflow during EA execution.

Files:
123
To add comments, please log in or register