Why does my object to count to it's location instead of just being placed there?

 
My object appears on screen briefly at a fractal then moves to my expected fractal. 


bool A_low()
   {  
      {
      if(histo())
         {
         val2=0;
         for (int i=histoupcount; val2==0; i++)
            {
            val2=iFractals(NULL, 0, MODE_LOWER, i);
            A = val2;
            if(A!=0)
               {
               
               atime=Time[i];
               //ObjectSet("B3",OBJPROP_BGCOLOR,clrLime);
               ObjectSet("B16",OBJPROP_TIME1,atime);
               ObjectSet("B16",OBJPROP_PRICE1,A);
               ObjectSet("B16",OBJPROP_ANCHOR,ANCHOR_UPPER);
               ObjectSetString(0,"B16",OBJPROP_TOOLTIP,"A Low = "+DoubleToStr(A,4));
               //Print(A, " A Low Located at bar ",i);               
   
               return(true);
               }
            }
         }
       }
    //ObjectDelete("B16");       
    return(false);                 
   }

The thing is that is sometimes appear before on chart in a location fractal that is (! histo())
Shouldn't it just appear at the location assigned ? 
Print text shows price and bar perfectly as expected and so I expect the object to be at that location only and never anywhere else. 

Please advise
Thanks
 
Agent86:
My object appears on screen briefly at a fractal then moves to my expected fractal. 



The thing is that is sometimes appear before on chart in a location fractal that is (! histo())
Shouldn't it just appear at the location assigned ? 
Print text shows price and bar perfectly as expected and so I expect the object to be at that location only and never anywhere else. 

Please advise
Thanks
You are setting its properties in a loop so it will potentially set multiple times 
Instead use the loop to find where you want it then set the object properties 
 
Paul Anscombe #:
You are setting its properties in a loop so it will potentially set multiple times 
Instead use the loop to find where you want it then set the object properties 

Thanks, I think I see it now.

I don't know why but I thought the loop would finish before proceeding to the if statement. 

Thanks