I have a need for a function to call itself and the number of times that it
must do so cant be easily determined before the first function call is made.
Does MQL4 allow a function to call itself (this capability
is known as recursive calling)???
- XAverage from TS to MT4
- Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes
- May I have trailing stop function for EA in MQL4?
I am just trying that now, started before few days much combinations, also had put
counter how many loops it had done, increasing stack size, but it seems that does
not help increasing much. I had came to conclusion that better is limited number
of repeated loops and when reached the defined number to break the loop function.
ex. for testing:
first.loop() { RefreshRates(); // counts first loop Count.first++; // external function call second.loop(); // readable how many loops Print(Count.first,", ",Count.second); } second.loop() { if ( Count.second > limit ) return(0); RefreshRates(); Count.second++; // break the function first.loop(); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register