Heiken Ashi Logic Step

 

In the heiken Ashi loop below, why do they differentiate the array that stores high and low data based on if the candle was bullish or bearish? Why wouldn't they always just have high and low data in the same array? Attached the full version if need to help me :)

   while(pos>=0)
     {
      haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;//you gotta start somewhere, where and with what do they start?
      haClose=(Open[pos]+High[pos]+Low[pos]+Close[pos])/4;
      haHigh=MathMax(High[pos], MathMax(haOpen, haClose));
      haLow=MathMin(Low[pos], MathMin(haOpen, haClose));
      if (haOpen<haClose) // IF BULLISH!....
        {
         ExtMapBuffer1[pos]=haLow;
         ExtMapBuffer2[pos]=haHigh;
        } 
      else
        {
         ExtMapBuffer1[pos]=haHigh;
         ExtMapBuffer2[pos]=haLow;
        } 
      ExtMapBuffer3[pos]=haOpen;
      ExtMapBuffer4[pos]=haClose;
           pos--;
     }
Files:
 
Bauer_Boy:

In the heiken Ashi loop below, why do they differentiate the array that stores high and low data based on if the candle was bullish or bearish? Why wouldn't they always just have high and low data in the same array? Attached the full version if need to help me :)

Hi, 
The ha code would translate as : 

if( prev_average of buf_3_&_buf_4 < current_price_average )
{ use haLow as the top price & use haHigh as the bottom price }  // this would have the effect of flipping the histogram pair to the opposite color 
else
{ use haHigh as the top price & haLow as the bottom price }

 
Thank you cameo, this makes more sense now
Reason: