MyAlgoMate
// INDICATOR FORMULA

Heikin Ashi candles: the formula and how to calculate them (with Excel)

Heikin Ashi candles are normal candles redrawn with averaged prices. Here are the four formulas that turn normal candles into the Heikin Ashi open, high, low and close, what the colour and wicks mean, and how they differ from normal candles — with a worked example, the Excel formulas, a free Excel sheet and a box to convert your own OHLC candles.

Last updated:

The Heikin Ashi formula

HA close = (Open + High + Low + Close) ÷ 4
HA open  = (previous HA open + previous HA close) ÷ 2
           first candle: (Open + Close) ÷ 2
HA high  = the highest of High, HA open and HA close
HA low   = the lowest of Low, HA open and HA close

“Heikin Ashi” is Japanese for “average bar”: each candle is an average of its own prices, and each open is carried over from the previous candle, which makes the chart smoother than normal candles.

How to calculate Heikin Ashi step by step

  1. HA close: average the candle's four prices. Day 1: (1,002.35 + 1,010.00 + 990.60 + 1,001.15) ÷ 4 = 1,001.0250.
  2. HA open of the first candle: halfway between its open and close. (1,002.35 + 1,001.15) ÷ 2 = 1,001.7500.
  3. HA high and HA low. Day 1's HA high is the largest of 1,010.00, 1,001.7500 and 1,001.0250 = 1,010.0000; its HA low is the smallest of 990.60, 1,001.7500 and 1,001.0250 = 990.6000.
  4. From the second candle, carry the open over. Day 2's HA open = (1,001.7500 + 1,001.0250) ÷ 2 = 1,001.3875, and its HA close = 994.8750.
  5. Repeat for every candle. Day 60's Heikin Ashi candle: open 980.4028, high 1,015.1500, low 980.4028, close 1,002.3250.

Worked example — and calculate Heikin Ashi from your own prices

The table works through 60 daily candles of an imaginary stock, column by column — the same columns as the Excel sheet. To calculate Heikin Ashi for your own stock, clear the box and paste your open, high, low, close from Excel or your broker's download.

One row per candle, oldest first. Paste straight from Excel or your broker's download; a date or time column becomes the row label. Filled with our example prices.

Latest values

HA open: 980.4028HA high: 1,015.1500HA low: 980.4028HA close: 1,002.3250
Heikin Ashi calculated from the example prices
DayOpenHighLowCloseHA openHA highHA lowHA close
Day 11,002.351,010.00990.601,001.151,001.75001,010.0000990.60001,001.0250
Day 2999.201,004.60987.75987.951,001.38751,004.6000987.7500994.8750
Day 3986.151,011.50986.001,009.15998.13131,011.5000986.0000998.2000
Day 41,007.801,015.001,001.851,012.60998.16561,015.0000998.16561,009.3125
Day 51,010.451,012.00990.80993.251,003.73911,012.0000990.80001,001.6250
Day 6995.651,012.60990.901,008.601,002.68201,012.6000990.90001,001.9375
Day 71,009.201,018.951,003.801,013.601,002.30981,018.95001,002.30981,011.3875
Day 81,012.001,012.95994.751,001.551,006.84861,012.9500994.75001,005.3125
Day 91,000.351,033.25995.301,031.551,006.08061,033.2500995.30001,015.1125
Day 101,031.451,046.151,028.501,040.051,010.59651,046.15001,010.59651,036.5375
Day 111,038.151,041.801,027.701,033.151,023.56701,041.80001,023.56701,035.2000
Day 121,037.151,065.801,031.151,064.801,029.38351,065.80001,029.38351,049.7250
Day 131,060.651,086.001,056.851,083.551,039.55431,086.00001,039.55431,071.7625
Day 141,084.551,090.251,067.251,067.951,055.65841,090.25001,055.65841,077.5000
Day 151,071.201,074.301,061.451,063.501,066.57921,074.30001,061.45001,067.6125
Day 161,066.251,067.351,025.901,030.201,067.09581,067.35001,025.90001,047.4250
Day 171,028.701,033.001,011.751,012.201,057.26041,057.26041,011.75001,021.4125
Day 181,015.901,019.90979.85981.601,039.33651,039.3365979.8500999.3125
Day 19981.60988.30969.40970.551,019.32451,019.3245969.4000977.4625
Day 20971.00973.10959.05960.90998.3935998.3935959.0500966.0125
Day 21960.00980.35958.30978.30982.2030982.2030958.3000969.2375
Day 22981.35981.50957.00958.85975.7202981.5000957.0000969.6750
Day 23958.80963.00942.60946.75972.6976972.6976942.6000952.7875
Day 24949.40957.70931.65937.95962.7426962.7426931.6500944.1750
Day 25936.60945.75926.05927.85953.4588953.4588926.0500934.0625
Day 26924.25924.60910.25911.20943.7606943.7606910.2500917.5750
Day 27912.10919.05900.00905.15930.6678930.6678900.0000909.0750
Day 28901.60904.50884.70885.95919.8714919.8714884.7000894.1875
Day 29885.85891.25871.55874.70907.0295907.0295871.5500880.8375
Day 30876.55880.70849.70855.80893.9335893.9335849.7000865.6875
Day 31858.30868.95858.15862.15879.8105879.8105858.1500861.8875
Day 32861.35875.05859.50866.45870.8490875.0500859.5000865.5875
Day 33866.85870.55843.00845.10868.2182870.5500843.0000856.3750
Day 34846.70854.70846.55851.55862.2966862.2966846.5500849.8750
Day 35849.20863.70847.85860.20856.0858863.7000847.8500855.2375
Day 36857.85862.95845.40854.80855.6617862.9500845.4000855.2500
Day 37858.20882.25858.05877.20855.4558882.2500855.4558868.9250
Day 38877.05893.65868.85888.45862.1904893.6500862.1904882.0000
Day 39890.40908.35889.60905.40872.0952908.3500872.0952898.4375
Day 40907.95913.10895.65896.80885.2664913.1000885.2664903.3750
Day 41893.65894.65887.85889.60894.3207894.6500887.8500891.4375
Day 42887.10898.55884.80895.30892.8791898.5500884.8000891.4375
Day 43895.30920.60889.25919.00892.1583920.6000889.2500906.0375
Day 44917.70920.60916.30918.35899.0979920.6000899.0979918.2375
Day 45916.60919.30903.80906.25908.6677919.3000903.8000911.4875
Day 46903.75937.35900.30932.10910.0776937.3500900.3000918.3750
Day 47935.25947.15930.20944.35914.2263947.1500914.2263939.2375
Day 48943.20949.20937.25948.70926.7319949.2000926.7319944.5875
Day 49950.55971.15949.05966.35935.6597971.1500935.6597959.2750
Day 50965.45965.90954.75955.60947.4673965.9000947.4673960.4250
Day 51956.10971.35954.15969.10953.9462971.3500953.9462962.6750
Day 52968.00997.00966.55984.35958.3106997.0000958.3106978.9750
Day 53986.40992.30980.25980.90968.6428992.3000968.6428984.9625
Day 54979.40984.70961.40962.50976.8026984.7000961.4000972.0000
Day 55960.05964.60953.00960.20974.4013974.4013953.0000959.4625
Day 56956.65969.05954.50967.35966.9319969.0500954.5000961.8875
Day 57965.05982.20960.60971.00964.4097982.2000960.6000969.7125
Day 58973.90987.10967.55981.75967.0611987.1000967.0611977.5750
Day 59980.15999.95979.00994.85972.3181999.9500972.3181988.4875
Day 60994.451,015.15987.351,012.35980.40281,015.1500980.40281,002.3250
Everything is worked out in your browser. Nothing you paste is stored or sent.

The example prices are made up for this page — they are not real market data. Heikin Ashi is a calculation from past prices, not a forecast, a signal or advice to buy or sell. MyAlgoMate provides trading technology, not investment advice.

How to calculate Heikin Ashi in Excel

Put the headings in row 1 and the first candle in row 2, oldest at the top. Then type these formulas — each column uses the ones to its left:

  1. A

    Day

    A2 downwards: your dates, oldest at the top.

  2. B

    Open

    B2 downwards: the open prices, oldest at the top.

  3. C

    High

    C2 downwards: the high prices, oldest at the top.

  4. D

    Low

    D2 downwards: the low prices, oldest at the top.

  5. E

    Close

    E2 downwards: the closing prices, oldest at the top.

  6. F

    HA open

    F2 =(B2+E2)/2 — this cell only (the starting value).

    F3 =(F2+I2)/2 — then copy it down to the last row.

  7. G

    HA high

    G2 =MAX(C2,F2,I2) — then copy it down to the last row.

  8. H

    HA low

    H2 =MIN(D2,F2,I2) — then copy it down to the last row.

  9. I

    HA close

    I2 =(B2+C2+D2+E2)/4 — then copy it down to the last row.

Only the first HA open (F2) uses a different formula; everything else is copied down from row 2 or 3.

Prefer not to type them? The free sheet has every formula filled in for the example prices — replace the prices with yours and extend the rows. It opens in Microsoft Excel (we checked every value against the table above), and you can import it into Google Sheets or LibreOffice.

Download the free Heikin Ashi Excel sheet (.xlsx)

What changes on a Heikin Ashi chart

Because every value is an average, Heikin Ashi candles move more smoothly than normal ones and hide some of the back-and-forth inside a run of candles. The trade-off is that the prices on the chart are no longer the real open, high, low and close. Heikin Ashi is a different way of drawing past prices — not a forecast or advice.

How a Heikin Ashi candle gets its colour and wicks

  • Colour. Green (or hollow) when the HA close is above the HA open, red (or filled) when it is below. In the example, 29 of the 60 Heikin Ashi candles are green and 31 red.
  • No lower wick on a green candle. The HA low is the lowest of the real low, the HA open and the HA close. When the HA open is at or below the real low, the HA low is the HA open, so the body starts at the bottom of the candle. 22of the example's green candles look like this.
  • No upper wick on a red candle. The same at the top: when the HA open is at or above the real high, the HA high is the HA open. 16of the example's red candles look like this.
  • Small body, long wicks on both sides. The HA open and HA close are close together while the real high and low are far apart — the averages barely moved while the price swung both ways.

These are descriptions of how the candle is built, not readings of what the price will do.

Heikin Ashi vs normal candles

Heikin Ashi candles compared with normal candles
Normal candleHeikin Ashi candle
OpenThe first traded price of the periodMidpoint of the previous HA body: (prev HA open + prev HA close) ÷ 2
CloseThe last traded price of the periodAverage of the period's open, high, low and close
High / lowThe real highest and lowest priceReal high / low, stretched to include the HA open and HA close
Real prices?YesNo — averages (the HA high or low can equal the real one)
Gaps between periodsShownNot shown — each body starts inside the previous one
Depends on earlier candles?NoYes — every HA open is carried over from the candle before
TimeOne candle per periodOne candle per period (unlike Renko)

Heikin Ashi vs Renko. Both look smoother than normal candles, but in different ways. Heikin Ashi still draws one candle for every period, just with averaged prices. Renko ignores time: it adds a fixed-size brick only when the price has moved by the brick size.

Why there are no gaps, and how long the first candle matters

Each HA open is the midpoint of the previous Heikin Ashi body, so every new body starts inside the one before it. A real gap between two sessions — say a stock opening well above yesterday's close — never shows as empty space on a Heikin Ashi chart; it only shows up inside the averages.

The same carry-over explains why two charts that start on different days disagree at first. The HA close does not depend on the HA open, so any difference in the starting HA open is exactly halved on every candle:

Share of a difference in the first HA open that is left after a number of candles
Candles laterDifference left
150.0%
312.5%
53.1%
70.78%
100.10%

After about seven candles less than 1% of the difference is left, so two charts usually agree by then. The HA high and low follow, because they are built from the HA open.

What Heikin Ashi hides

  • The real prices. The HA open and close are averages, so the chart does not show where the price actually opened or closed.
  • Gaps. They are smoothed into the averages (see above).
  • Timing. Each value averages earlier prices, so a change of colour comes after the price has already moved.
  • The live candle. Until the period closes, the HA close (and so the colour) keeps changing with every new price.

If you use Heikin Ashi values in alerts or automation — for example TradingView alerts sent to your broker — remember that orders are always filled at real market prices, not at Heikin Ashi prices.

// FAQ

Heikin Ashi calculation — questions, answered.

HA close = (Open + High + Low + Close) ÷ 4. HA open = (previous HA open + previous HA close) ÷ 2, and for the very first candle (Open + Close) ÷ 2. HA high = the highest of the High, the HA open and the HA close; HA low = the lowest of the Low, the HA open and the HA close.

HA open = (previous HA open + previous HA close) ÷ 2 — the midpoint of the previous Heikin Ashi candle's body. The first candle has no previous HA candle, so its HA open is (Open + Close) ÷ 2 of the normal candle.

Open, high, low and close in columns B to E from row 2. HA close in I2: =(B2+C2+D2+E2)/4. HA open in F2: =(B2+E2)/2, then from F3: =(F2+I2)/2. HA high in G2: =MAX(C2,F2,I2); HA low in H2: =MIN(D2,F2,I2). Copy everything down.

Heikin Ashi candles are a different way of drawing the same price history. Each candle's close is the average of the normal candle's open, high, low and close, and each open is the midpoint of the previous Heikin Ashi candle's body. The chart looks smoother than normal candlesticks, but its prices are averages, not real traded prices.

Only how its two averages compare: it is drawn green (or hollow) when the HA close is above the HA open, and red (or filled) when it is below. Because both are averages of earlier prices, the colour changes after the price has already moved. It describes past prices, not what comes next.

HA low is the lowest of the real low, the HA open and the HA close. When the HA open is at or below the real low, the HA low equals the HA open and a green candle has no lower wick. On a red candle the same happens at the top: when the HA open is at or above the real high, there is no upper wick.

No. It is an average of the candle's four prices, so it is usually not a price anything actually traded at. Orders are filled at real market prices, so if you automate anything, the price that matters is the normal candle's, not the Heikin Ashi one.

Each HA open depends on the one before it, all the way back to the first candle, so the starting point matters — the difference fades after a few candles. Spot vs futures prices and the timeframe change them too.

More indicator formulas, with Excel sheets

Turn your own rules into automated orders.

Already use Heikin Ashi in your own rules? MyAlgoMate's algo trading software places the orders your rules call for at 150+ Indian brokers — and TradeBridge turns your own TradingView or Chartink alerts into live orders. You decide the rules; we provide the technology.

Share this page