- Desktop
- Scripting
- Formulas and Scripting Functions
- Heikin-Ashi Candlestick Function - HAC()
Heikin-Ashi Candlestick Function - HAC()
Heikin-Ashi candles are a modified version of candlestick charts which were designed to allow for better identification and analysis of trends. When scanning for conditions based on Heikin-Ashi candle values (including in watchlist columns) you first need to use the HAC() function to convert the data to Heikin-Ashi values (Note: this is not the case for Show Bar - see below).
To show the RSI(14) values of H-A candles in a watchlist use the following:
//Set data to Heikin-AshiV1=HAC();
//Calc RSI of H-A values by nesting V1 in the RSI function;RSI(V1,BARS=14)This is how they compare to the RSI on a regular candlestick chart:

Moving Average Cross Scan on Heikin-Ashi Values
Section titled “Moving Average Cross Scan on Heikin-Ashi Values”//Set data to Heikin-AshiV1=HAC();
//Calc MA(20) of H-A values by nesting V1 in the MA function;MA20=MA(V1, BARS=20, CALC=Close);
//Does H-A Close Cross Above H-A MA20)CLOSE(V1) CrossesAbove MA20Moving Average Cross Show Bar on Heikin-Ashi chart
Section titled “Moving Average Cross Show Bar on Heikin-Ashi chart”If applying a Show Bar formula to a chart that has already been converted to Heikin-Ashi candles then the HAC() function should not be used - simply use the same formula that you would on a regular candlestick chart:
CLOSE() CrossesAbove MA(BARS=20, CALC=Close)Your privacy choices
We use cookies and similar technologies to make the site work, see how it's used, and improve it. Analytics and advertising cookies only run with your consent — see our Privacy Policy for details.