Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

if statement evaluated when false, HELP.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    if statement evaluated when false, HELP.

    I am trying to understand why an if statement is getting processed even tho it is false, I have walked thru the code in Microsoft Visual Studio and have confirmed that the values are false,

    here is the code:-

    Code:
     if((highTest - lowTest) < (softSpotRange * TickSize)) 
    	{
    	highTest = Math.Round(highTest - 1 * TickSize,2,MidpointRounding.AwayFromZero);
    	lowTest  = Low[0];
    	a=2; //retest full range
    												
    	      if((highTest - lowTest) < (softSpotRange * TickSize));
    	      {
    			stopLooking = true;
    			break;
    		}
    							
    
    	}
    So when the first if statement is true highTest is reduced by 1 tick and lowTest is reset to Low[0]. The following if statement is then false but its getting processed????

    So i have no idea why this is.

    #2
    GKonheiser, it could only be processed if the condition would evaluate to 'true', there's no ambiguity here. How do you judge by it's getting processed? By your value for stopLooking being set to 'true'?

    Comment


      #3
      I am stepping tho it with visual studio and it is processing inside the brackets. I have attached a screen shot. If you look at it you can see that the values equate to false but it is still looking inside the brackets???
      Attached Files

      Comment


        #4
        Is this the only location your stopLooking could be set to the 'true' value?

        Comment


          #5
          No there are other places but that isn't the problem, you can see in the screenshot that the statement is false but the yellow arrow is still inside the brackets. If you step thou the code using f11 it would go inside the brackets if it wasn't processing it.

          Comment


            #6
            Originally posted by GKonheiser View Post
            I am trying to understand why an if statement is getting processed even tho it is false, I have walked thru the code in Microsoft Visual Studio and have confirmed that the values are false,

            here is the code:-

            Code:
             if((highTest - lowTest) < (softSpotRange * TickSize)) 
            	{
            	highTest = Math.Round(highTest - 1 * TickSize,2,MidpointRounding.AwayFromZero);
            	lowTest  = Low[0];
            	a=2; //retest full range
            												
            	      if((highTest - lowTest) < (softSpotRange * TickSize))[COLOR="Red"][B][SIZE="5"];[/SIZE][/B][/COLOR]
            	      {
            			stopLooking = true;
            			break;
            		}
            							
            
            	}
            So when the first if statement is true highTest is reduced by 1 tick and lowTest is reset to Low[0]. The following if statement is then false but its getting processed????

            So i have no idea why this is.
            Your "if statement" is null, because of the semi-colon that I have emphasized in red.

            Comment


              #7
              Thanks koganam, I missed that.

              Comment


                #8
                Your a star thx. I just didnt see that.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                579 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                554 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X