"possible use of uninitialized variable 'XYZ'" - despite it being initialised

 

My patience is seriously wearing thin right now. 

Why am constantly getting this stupid, bloody warning despite everything being correctly initialised?
Why is it only focusing on the on those variables with the second iteration, i.e.

CandleBody[2]
CandleOpen[2]
CandleClose[2]


I am seriously going to lose my temper. If I see that warning one more time, I will pick this computer up, and I will throw it against the wall. Tired of battling with non-existent warnings all the time. 

It is NOT a "possible use of uninitialized variable", it's a correctly initialised variable, so why isn't my terminal seeing it as that? 

bool MorningStar(){
    
    double CandleOpen[6];
    double CandleClose[6];
    double CandleBody[6];

    for(int i = 0; i < 6; i++){
        
        CandleOpen[i]   = iOpen(CurrentChartSymbol, 0, i) / _Point;
        
        CandleClose[i]  = iClose(CurrentChartSymbol, 0, i) / _Point;
        
        CandleBody[i]   = NormalizeDouble(MathAbs(CandleClose[i] - CandleOpen[i]), Digits);
        
    }

     if(CandleClose[2] < CandleOpen[2] && CandleClose[4] > CandleOpen[4]){
     
         if(CandleBody[3] / CandleBody[2] <= ComparisonPercentage){
         
             if(CandleBody[3] / CandleBody[4] <= ComparisonPercentage){
             
                    return true;
           
             }
             
         } else {
         
            if(CandleClose[3] < CandleOpen[3]){
            
               if(CandleClose[5] > CandleOpen[5]){
               
                  if(CandleBody[4] / CandleBody[3] <= 1){
                 
                        return true;
                     
                  }
               
               }
            
            }
         
         }

     }
    
    return false;
}

possible use of uninitialized variable 'CandleOpen'     2024.18.2.1.mq4 618     26
possible use of uninitialized variable 'CandleClose'    2024.18.2.1.mq4 618     9
possible use of uninitialized variable 'CandleBody'     2024.18.2.1.mq4 620     29

  • Removed the `_Point`, oh no, that wasn't good enough.
  • I even skipped over the second iterations and made it continue, nope, if course that didn't work because then that would make my life easy, and we can't be having that, cant we? 

Sometimes, I just wonder why I bother. I just get IT shoved in my face constantly, constant non-existent issue because evidently have a great big neon sign with an arrow that points to my head, that is only invisible to me, and it says "Please, make this guys life as difficult as possible to the point where he has a nervous breakdown

Why is the MQL4 interpreter failing to see that everything is bloody initialised?! 

 

you can do this :

    double CandleOpen[6]={};
    double CandleClose[6]={};
    double CandleBody[6]={};

you are also dividing the prices by the point of the chart not the point of the symbol you are querrying prices for

same for the digits in the normalize function

 
Lorentzos Roussos #:

you can do this :

you are also dividing the prices by the point of the chart not the point of the symbol you are querrying prices for

same for the digits in the normalize function

Thank you. Much appreciated.