Defining HO for Heikin Ashi

Dear experts,

The Heikin Ashi candle opening is defined in Stockcharts.com as

HA-Open = (HA-Open(-1) + HA-Close(-1)) / 2 

How can we program this in Tradescript. The problem is Defining HO refers to another pre-existing HO for previous time period. That is:

SET HO = (REF(HO,1) + REF(HC,1))/2

As we are Setting HO for the first time now, how can we have a hitherto undefined HO on RHS also?

Could you please suggest how to code this?

Thanks

Heikin Ashi   code is there by default in Pi under  Artificial Intelligence  -> apply Expert Advisors

you can make use of it

Brother you will never get his answer especially when it I related toheiken ashi… He is such a waste. I m sure he is a zerodha staff. Your question is simplest and he is asking you that he didn’t understand it. Instead of simply saying I am not able to code this he is trying to show we are asking him wrong… He is fooling everybody for his lack of knowledge

Please Sir… The code available under Artificial Intelligence is only for HA Close. There is nothing for HA-Open or HA-Low or HA-High. All 4 are needed to generate one complete HA candle. HA-Close, HA-High and HA-Low are easy to code. My question is for HA-Open.