Help for a code

 

Hi everyone.
I need you for solve a problem on the Strategy Tester.
I'm making an EA and at the real market everything goes right.

But at the moment that I try it on to the Strategy tester this one doesn't start. it looks like if there were an infinite bucle and my MT4 platform stop running.

void MACDAyByPos(){

   double PrecioVelaMACD = 0;
   int CAltos = 0;//Contador altos
   int CBajos = 0;//Contador Bajos

   int i = 0;
   if(iMACD(NULL,60,12,26,9,PRICE_CLOSE,MODE_MAIN,0) > 0)MACDPosActual = 1;
   else MACDPosActual = 2;
   
//------------------------OBTENER LOS PRECIOS DE BAJOS Y ALTOS-------------------------------------------------------------------
   while (CAltos != 3 || CBajos != 3 ){
      double PreciosAltos = 0;
      double PreciosBajos = 0;
      PrecioVelaMACD = iMACD(NULL,60,12,26,9,PRICE_CLOSE,MODE_MAIN,i);
      
      
      
      //-----------------------------------------------------------------------Altos-----
      if(PrecioVelaMACD > 0.0002 && CAltos != 3){//alto
      
/////-------------------------------------------------------------------------------------------------------|<---
         while(PrecioVelaMACD > 0){//                                                                       |<---
            PrecioVelaMACD = iMACD(NULL,60,12,26,9,PRICE_CLOSE,MODE_MAIN,i);//                              |<---
            if(PrecioVelaMACD > PreciosAltos){//                                                            |<---
               PreciosAltos = PrecioVelaMACD;//                                                             |<---
               iAltos[CAltos] = i;//                                                                        |<---
            }//                                                                                             |<---
            i++;//                                                                                          |<---
         }//                                                                                                |<---
/////-------------------------------------------------------------------------------------------------------|<---         
         
         CAltos++;
         
      }
      
      //------------------------------------------------------------------------Bajos-----
      else if(PrecioVelaMACD < -0.0002 && CBajos != 3){//bajo
      
/////-------------------------------------------------------------------------------------------------------|<---      
         while(PrecioVelaMACD < 0){//                                                                       |<---
            PrecioVelaMACD = iMACD(NULL,60,12,26,9,PRICE_CLOSE,MODE_MAIN,i);//                              |<---
            if(PrecioVelaMACD < PreciosBajos){//                                                            |<---
               PreciosBajos = PrecioVelaMACD;//                                                             |<---
               iBajos[CBajos] = i;//                                                                        |<---
            }//                                                                                             |<---
            i++;//                                                                                          |<---
         }//                                                                                                |<---
/////-------------------------------------------------------------------------------------------------------|<--- 

         CBajos++;
         
      }else i++;
   
   }
//-----------------------FIN DE OBTENCION DE PRECIOS-----------------------------------
   
}

This one is  the part where the problem is at. (This part of the code detects the Higger Highs and lowwer lows of a MACD indicator. Sorry for the variables, those are on spanish hahah )
When I take away the part that is where the arrows are pointing, the Strategy Tester works as usual. But when I use it, well...

I hope you can help me. Thanks in advance. 😃