Heikin Ashi O,C,L,H values

 

Hello,


I'd like to compute O,C,L,H Heikin Ashi values and also check if candlestick is red or each tick for my Automated Trading System, but I don't know how to convert:

      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;
        } 
      ExtMapBuffer3[pos]=haOpen;
      ExtMapBuffer4[pos]=haClose;
 	   pos--;

to code which assigns value to haO,haC,haH,haL,red,white variables.



Main problem is how to count up haO(t-1) and haC(t-1) because I don't have previous data.


The iCustom probably can't show me all the values.


Thank's for your replies!


PS
The code is cut from Heikin-Ashi Indicator from MQL4 Code Base.