How to convert OHLC data to Heikin Ashi OHLC Format

Hi,

I am trying to get Heikin Ashi candle data using regular OHLC candle. I got the formulas from internet and I have implemented it. But as Heikin Ashi candle open price depends on previous candle, I am struggling to get the first candle’s Open price calculated correctly.

It will be great if someone help me to get the same.

I am trying to get the heikin ashi candle data for Banknifty Weekly Options.

Thanks

For the first Heikin Ashi Candle’s Open calculation, use
1st HA Open = (Normal candle Open + Normal candle Close) / 2

For further Heikin Ashi Candles’ Open calculation, use
HA Open = (Previous HA Open + Previous HA Close) / 2

The effect of this adjusted approximation would dissipate after 4-5 candles, so no worries.