"USING THE HEIKIN-ASHI TECHNIQUE" by Dan Valcu

Here are the definitions for the modified OHLC values for the heikin-ashi candlestick technique.
haClose = (O+H+L+C)/4
haOpen = (haOpen (previous bar) + haClose (previous bar))/2
haHigh = Maximum(H, haOpen, haClose)
haLow = Minimum(L, haOpen, haClose)

__________________________________________________________________________

Here's how to calculate the modified OHCL values using a spreadsheet for the heikin-ashi candlestick technique.

Heikin-Ashi OHLC values

To illustrate the calculation of heikin-ashi OHCL values in a spreadsheet (sidebar Figure 1), I used daily data for the US Dollar Index (4/24/03-8/22/03). You can use intraday, weekly, or any other time frame for the data.

To build the data table and the chart associated with it, follow these steps:

  • Step 1: Copy daily data (date, open, high, low, close) into columns A, B, C, D, and E, through to the last column.
  • Step 2: Reserve columns F, G, H, and I as heikin-ashi values for modified open, high, low, and close: haOpen, haHigh, haLow, haClose.
  • Step 3: Enter the following formulas corresponding to the first day in the data table:
            In cell F2: =B2
            In cell G2: =MAX(C2,F2,I2)
            In cell H2: =MIN(D2,F2,I2)
            In cell I2: =SUM(B2:E2)/4
    
            Observe that cell F2 contains the value for the real 
            open for day 1.
            
            You also have the option to enter zero in cell F2 and 
            MIN(D2,I2) in cell H2. But in this case the range used 
            to display the chart will be the date for the x axis, 
            and haOpen, haHigh, haLow, and haClose for the y axis.
    
  • Step 4: Enter the following formulas:
            In cell F3: =(F2+I2)/2
            In cell G3: =MAX(C3,F3,I3)
            In cell H3: =MIN(D3,F3,I3)
            In cell I3: =SUM(B3:E3)/4
    
    
  • Step 5: Select cells F3, G3, H3, and I3 and copy them down to the end of price data. Columns F, G, H, and I now contain the heikin-ashi values for open, high, low, and close.
  • Step 6: Create a candlestick chart in Excel using the date (column A) for the x axis and range F2 to the last value in column I as the data range. The chart should look like the one in sidebar Figure 2.

    -DV __________________________________________________________________________

    Here are MetaStock formulas for indicators based on heikin-ashi candlestick OHLC values.

    Defining simple indicators with MetaStock based on modified OHLC values

     

    In MetaStock, choose Tools, Indicator Builder, and New to create these four new indicators:

    Name: haClose
    
    haclose:=(O+H+L+C)/4;
    haclose;
    
    
    Name: haOpen
    
    haopen:=(PREV+Ref(Fml("haClose"),-1))/2;
    haopen;
    
    
    Name: haDiffCO
    
    hadiffco:= Fml("haClose") - Fml("haOpen");
    hadiffco;
    
    
    Name: Mov-haDiffCO
    
    Periods:=Input("Time periods",3,50,3);
    movhadiffco:= Mov(Fml("haDiffCO"),Periods,S);
    movhadiffco;
    
    -DV
    
    __________________________________________________________________________

    Here are the formulas for the heikin-ashi candlesticks given on page 28 of Dan Valcu's article.

    Another interesting feature is the anticipation of a change in the strength of the next trading bar. Assume you are at the end of today's trading session. Based on the calculation of haOpen:

    haOpen (tomorrow) = (haOpen(today) + haClose(today))/2  (A)
    
    The position of haClose(tomorrow) versus haOpen(tomorrow) 
    will determine the color of the candle body:
    
    If haClose(tomorrow) > haOpen(tomorrow)         (B)
            Body (tomorrow) = white
    Else
            Body (tomorrow) = filled/red
    Endif