Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 893
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
There is a question like this. So, there is a loop
The 1stbreak is located not in first parentheses of the loop but in parentheses nested inside them. The 2ndbreak is even deeper nested in inner parentheses. As I understood in this casebreak simply doesn't work, to tell the truth I didn't understand if it worked or not but the program hung up and made unnecessary iterations. In order to exit a loop with a lot of conditions I added an exit flag to the loop. Maybe it seemed to me that it doesn't work, who thinks on this issue?
If the code is styled normally, you can see right away that you've made a rubbish out of it:
Exactly the same:
Unable to update the candlesticks and add ticks.
Here is the code for the indicators:
The indicator is then applied to check bets:
Exit:
If the candlesticks are fully updated, why does rate_total only show 50% of the candlesticks?
Please advise me.
With normal code styling, it's immediately obvious that it's bullshit:
So in my case it may not work correctly and it really may not exit the loop or will it exit the closest loop in the body of which the condition is located anyway?
So in my case it might not work correctly and it might not actually exit the loop, or will it exit the closest loop whose body contains the condition anyway?
I don't see the loop conditions - you have a dash there:
for(...........)
I don't see the loop condition - you have a dotted line there:
It's not about the loop condition, it's about the fact that there may be more ifs inside the if and one of those ifs will have to generate an exit, so the question is, does the depth of the condition affect whether the loop will leave or not?
so the question is: does the depth of the condition affect whether the loop will leave or not?
it does not, break will break the closest loop body, i.e. the one in which it is currently executed, and how many times you use if() does not matter, neither the number of iF() nor their depth
well, part of the sentence, if you want to break the body of the loop by different conditions, sometimes it's much easier to use while() and the loop interrupt flag, like this:
does not affect, break will break the closest loop body, i.e. the one in which it is currently executed, and how many times you use if() does not matter, neither the number of iF() nor their depth
well, part of the sentence, if you want to break a loop body by different conditions, sometimes it's much easier to use while() and a loop interrupt flag, something like this:
I see what I'm getting at. Well yes it can be complicated and sometimes it's really better to use a flag. I'm just experimenting, I see it hangs, I thought it may endlessly loop, thanks for the answers.
There is a question like this. So, there is a loop
The 1stbreak is located not in first parentheses of the loop but in parentheses nested inside them. The 2ndbreak is even deeper nested in inner parentheses. As I understood in this casebreak simply doesn't work, to tell the truth I didn't understand if it worked or not but the program hung up and made unnecessary iterations. In order to exit a loop with a lot of conditions I added an exit flag to the loop. Maybe it seemed to me that it does not work, who thinks on this issue?
Although maybe I didn't quite get the point of your idea.
I would do it like this
Although, maybe I don't quite get the point of your idea.
The main thing is not to get confused. There are cases when you open another loop inside a loop and need to exit both loops at once, but mql4 does not provide this only through a flag, C++ has goto operator I wonder how it works.
The main thing is not to get confused. There are cases when you open another loop inside a loop and need to exit both loops at once, but mql4 does not provide this only through a flag, C++ has goto operator I wonder how it works.
You do all loops in a function, and if you need to exit any nested one - even three hundredth - return;