Problem with EMPTY_VALUE - page 3

 

Sorry about that, when I copied it from your earlier post I didn't notice it was in a potentialy infinate while loop. Limit j to run just a few bars and see what happens. I would say your problem is not with EMPTY_VALUE, it is more likely because at no time do all 4 of your conditions run true at the same time in either set, therfore it never reaches break.

int j = 0;
      double su = 0.0, sd = 0.0, su_prev = 0.0, sd_prev = 0.0;
      
      while(true)
      {if(j>5) break;
       su = iCustom(Symb, MajorPeriod, "Slope_Direction_Line", SlopePeriod, SlopeMethod, SlopePrice, 0, j);
       sd = iCustom(Symb, MajorPeriod, "Slope_Direction_Line", SlopePeriod, SlopeMethod, SlopePrice, 1, j);
       su_prev = iCustom(Symb, MajorPeriod, "Slope_Direction_Line", SlopePeriod, SlopeMethod, SlopePrice, 0, j + 1);
       sd_prev = iCustom(Symb, MajorPeriod, "Slope_Direction_Line", SlopePeriod, SlopeMethod, SlopePrice, 1, j + 1);
         
       if(su != EMPTY_VALUE)
       {Alert("1 su = ",su);
        if(sd == EMPTY_VALUE)
        {Alert("2");
         if(su_prev == EMPTY_VALUE)
         {Alert("3");
          if(sd_prev != EMPTY_VALUE)
          {Alert("4");
           Sub_Ind_Min = ArrayMinimum(Low, SubFiboBars, MajorPeriod * j / Period());
           Sub_Ind_Max = ArrayMaximum(High, SubFiboBars, MajorPeriod * j / Period());
           break;
       }}}}
       if(su == EMPTY_VALUE)
       {Alert("5");
        if(sd != EMPTY_VALUE)
        {Alert("6");
         if(su_prev != EMPTY_VALUE)
         {Alert("7");
          if(sd_prev == EMPTY_VALUE)
          {Alert("8");
           Sub_Ind_Min = ArrayMinimum(Low, SubFiboBars, MajorPeriod * j / Period());
           Sub_Ind_Max = ArrayMaximum(High, SubFiboBars, MajorPeriod * j / Period());
           break;
       }}}}
       j++;
      }
Reason: