
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
That makes no difference, I think. I could also write IF( StringHighStatus == "True" || SwingHighShift > SwingBarcount ) EndCycle = TRUE;
The point is why the IF detects the exit condition and then the WHILE reacts to the bool variable whilst if I put the same condition inside the WHILE it doesn't end?
That makes no difference, I think. I could also write IF( StringHighStatus == "True" || SwingHighShift > SwingBarcount ) EndCycle = TRUE;
The point is why the IF detects the exit condition and then the WHILE reacts to the bool variable whilst if I put the same condition inside the WHILE it doesn't end?
Looks to me this works
as
deVries, maybe I'm wrong but I think that a sequence of IF turns the boolean to TRUE as a logical OR does.
If the first condition matches then EndCycle turns to TRUE, if the second one doesn't then it remains TRUE.
Viceversa if the first is not met but the second one is, then it becomes TRUE.
At this time the WHILE recognizes the exit condition.
So two IFs in sequence behave like a logical OR and the same does an IF...ELSE IF sequence.
And it must be an OR, it can't be an AND otherwise the WHILE can stuck (the condition on the string can be false indefinitely).
Why the WHILE manages a single boolean variable whose value is set inside the cycle whilst it can't determine the result of the same logical OR operation inside his condition definition?
This EA has been used by a lot of people in the past, before build 600 and also before 500, and this is the last release. No one complained.
So my question is: is there anyone experiencing troubles with the WHILE operator after build 600?
deVries, maybe I'm wrong but I think that a sequence of IF turns the boolean to TRUE as a logical OR does.
If the first condition matches then EndCycle turns to TRUE, if the second one doesn't then it remains TRUE.
Viceversa if the first is not met but the second one is, then it becomes TRUE.
At this time the WHILE recognizes the exit condition.
So two IFs in sequence behave like a logical OR and the same does an IF...ELSE IF sequence.
And it must be an OR, it can't be an AND otherwise the WHILE can stuck (the condition on the string can be false indefinitely).
Why the WHILE manages a single boolean variable whose value is set inside the cycle whilst it can't determine the result of the same logical OR operation inside his condition definition?
This EA has been used by a lot of people in the past, before build 600 and also before 500, and this is the last release. No one complained.
So my question is: is there anyone experiencing troubles with the WHILE operator after build 600?
I think that you are referring to this
Your code, if exactly as you posted would have not done as you expect with any build, so you must have changed something
Have you ever tried a very basic while logic operations just to confirm it is working like it should or not, instead of asking?
My post started with an example of a WHILE that seemed to me to return an unusual behaviour very similar to that of the chunk of EA we are discussing now, so I first tried then asked.
My interpretation of that very simple debugging turned out to be wrong so the discussion moved to the EA itself.
Thank you GumRai for your patience.
Maybe I'm wrong and hard headed but I can't understand the logic...
If the first IF turns, as you suggest, the string to "true" at say SwinghHighShift=10 then the counted doesn't increase in that cycle; after that the control gets back to the WHILE: the cycle should end at this point because the WHILE contains a logical OR and one of it's condition is satisfied.
Conversely if the variable stays false the counter should reach its maximum value and again you have the exit condition.
I think your consideration would be true with an AND operator.
Following your interpretation I could skip the OR inside the WHILE; I could just put the first IF condition on the string: if turns to "true" then the break will end the WHILE, otherwise the counter would go on on till its maximum.
The code will turn to:
But this is still a workaround and, sadly, it does not explain (to me) why the WHILE doesn't take care of the OR.
If the first IF turns, as you suggest, the string to "true" at say SwinghHighShift=10 then the counted doesn't increase in that cycle; after that the control gets back to the WHILE: the cycle should end at this point because the WHILE contains a logical OR and one of it's condition is satisfied.