Using Indicators with Heikin Ashi Chart Style
Author: cwfong
Creation Date: 10/21/2019 7:12 PM
profile picture

cwfong

#1
Hi,

When I switch a chart style from regular candles to Heikin Ashi candles, I expect any applicable indicators on the chart to also change accordingly. This does not seem to be the case. The indicators plots stay the same as if the indicators are plotted only based on the regular candles. Maybe I am missing some setting or misunderstanding how Heikin chart works but I have checked the wiki/forum posts and found no answer. Thanks for your help.
profile picture

Eugene

#2
Hi,

Your expectation is not correct. The indicators stay always based on the regular bars. ChartStyles are just chart styles - an eye candy. For indicators to apply to a ChartStyle it'd require certain development effort. For example, see the WealthScript Programming Guide > Backtesting with ChartStyles.Trending: these chart styles are specially crafted to allow for it.

Although H-A code sample exists in the QuickRef tool (F11 key) > Bars object > SaveToFile and there are several forum threads with code examples which illustrate the creation of H-A bars, to my surprise none of them feature the application of indicators to H-A:

https://www.wealth-lab.com/Forum/Posts/Create-a-Heikin-Ashi-Bars-Object-39591

Fortunately, it's easy with Heikin Ashi. All these examples teach how to create a H-A Bars object. Applying a DataSeries (an indicator) to the H-A Bars is nothing different from applying one to the regular Bars object. For instance, let's create a H-A bars on the fly, plot it on a ChartPane and apply a SMA to the H-A Bars object:

CODE:
Please log in to see this code.


profile picture

cwfong

#3
Thanks. I will play with this.
profile picture

Eugene

#4
You're welcome. Let me know if you have followup questions.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).