Download MetaTrader 5

Stack overflow error - help?!

To add comments, please log in or register
Tinashe Chipomho
422
Tinashe Chipomho  

Hi

I have an indicator that is stopping with a stack overflow error. I thought maybe because i am using a recursive function so i rewrote it removed the recursive function and i am still getting the overflow error.

instead of just using an indicator i converted the code to be an EA added the directive stacksize to 16MB but i am still getting the same error, are there any other issues that cause this error that i should be aware of?

whroeder1
16563
whroeder1  
Tinashe Chipomho: are there any other issues that cause this error
No, you have an infinite recursive loop. EA or indicator is irrelevant.
Tinashe Chipomho
422
Tinashe Chipomho  
whroeder1:
No, you have an infinite recursive loop. EA or indicator is irrelevant.
i had one recursive loop which was not infinite by the way, at the most it will call itself up to 6times. I removed that recursive logic it was running for a while, but now its not!!!
whroeder1
16563
whroeder1  
Tinashe Chipomho: . I removed that recursive logic it was running for a while, but now its not!!!
You are misleading your self. There is only one way to get stack overflows - a infinite recursive loop.
  1. Print your entries and exits
  2. Or run it under the debugger.
Tinashe Chipomho
422
Tinashe Chipomho  
whroeder1:
You are misleading your self. There is only one way to get stack overflows - a infinite recursive loop.
  1. Print your entries and exits
  2. Or run it under the debugger.


You are absolutely right!!! a stray line of code which is was not supposed to be there doing a infinite recursive loop

I got rid of it and i am in the clear now... i should stop coding when tired

Thanks a lot!!!

whroeder1
16563
whroeder1  
Tinashe Chipomho: i should stop coding when tired
Been there, done that. Worked 18+ hours straight until someone asked "you still here?" In the zone! Quit after 6 hours when I've been looking at the same page for an hour, no point continuing.
Tinashe Chipomho
422
Tinashe Chipomho  
whroeder1:
Been there, done that. Worked 18+ hours straight until someone asked "you still here?" In the zone! Quit after 6 hours when I've been looking at the same page for an hour, no point continuing.


i added that code when i was very tired, and it was a copy and paste, a function A that was calling my function B. now I copied some logic in function A and added it to function B (just beacuse i didnt want to rewrite the for loop in function B) then i forgot to delete that line in function A that was calling function B basically function B was calling it self endlessly...

i burned a lot of hours trying to uproot this bug


Good lesson!!!

To add comments, please log in or register