kurtsmock

Dead Simple Heikin Ashi Candles (HA Candles)

kurtsmock Updated   
Are you looking for a dead simple calculation of the Heikin Ashi candles as they are calculated in tradingview? Here it is!

I was looking through the library and I saw that many have come up with a lot of awesome scripts using heikin ashi candles. But, I can't find anywhere that had the straightforward simple version of how Tradingview calculates them. This was a problem for me because I realized after punching the formula in that TradingView doesn't calculate HA candles in the original way.

You might say they don't calculate them the "right" but, spoiler alert, there is no right in trading. You can only be rational or irrational as you make money or lose money.

This is useful to me for building out some portions of an algo that are not going to be compatible with the built-in function. It happens. So, if you were looking for it too, hopefully it saves you some time.

For reference the original calc of HA candles is:
o = (prev_HA_open + prev_HA_close) / 2
h = math.max(high, ha_open, ha_close)
l = math.min(low, ha_open, ha_close)
c = ohlc4 

Trade Well.
Release Notes:
Added Color modification capability by request.
Release Notes:
AAAAAnnnddd there was a typo in the code. 🤦

Before I die I hope that just once I can publish something that doesn't immediately require an update. lol

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?