When does the Heiken Ashi change color?

 

I know how it's calculated:

Close = (Open Price + High + Low +Close) / 4

Open = (Average of Open Price and Close Price of the previous bar)

High = (Maximum value of the (High, Open, Close))

Low = (Minimum value of the (Low, Open, Close))

 

 

But I don't know how it gets a blue color or a red color.

I thought it'd be like regular candlesticks and that if the close price is above the open price then it's a blue candle, and vice-versa for red candles, but I was wrong. 

 

How do I calculate if it's a positive or a negative Heiken Ashi?

 

Thank you! 

 
Thanks, but that doesn't really tell how they change color..
 
metacooler: Thanks, but that doesn't really tell how they change color..
So learn to code. Open the Heiken Ashi and you see
      haOpen=(ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2;
      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) 
        {
         ExtMapBuffer1[pos]=haLow;
         ExtMapBuffer2[pos]=haHigh;
        } 
      else
        {
         ExtMapBuffer1[pos]=haHigh;
         ExtMapBuffer2[pos]=haLow;
        } 
 
open = previous open/close average. Close = typical price. Up candle one color, down the other.
 

Just do like WHRoeder advises. Open the code.

If you don't see how they change the color in the code that you have, search the internet foe other Heiken Ashi codes. There are gazillion varioations posted, most of them are in color, which means you can see how they change the color by studying the code. Learning takes work, you have to put in the work!

 

Thanks for the help. I got it now.

Reason: