Heikin Ashi Candlesticks Trading Strategy (Backtest And Performance Analysis)
A reader recently asked if we use Heikin Ashi Candlestick in our trading. So what exactly is Heikin Ashi? In this article, we will reconsider the price representation called Heikin-Ashi, and try to get something good out of the charting technique to use it for algorithmic trading. Can we make a Heikin Ashi trading strategy?
Yes, we show you a profitable Heikin Ashi trading strategy. Moreover, we test some additional filters to improve Heikin Ashi so we can use it as a stand-alone Heikin Ashi trading strategy.
The Heikin-Ashi method was imported into the West from Japan in the second half of the 90s and is a representation of prices aimed at highlighting the presence of trends or phases of consolidation. Thus, in short, Heikin Ashi is another version of Japanese candlesticks. Let’s dig a bit further into the charting method.
What is Heikin Ashi Candlestick?
The name implies it originates from Japan. As it turns out, Heikin Ashi candlesticks are another version of the famous Japanese candlesticks used in all our charting. Presumably, Heikin Ashi means “average bar” in Japanese, which sums up the difference between the two forms of candlesticks.
Candlesticks show the daily price action of the open, high, low, and close, while Heikin Ashi aims to indicate the trend by smoothing the price movements. Heikin Ashi is, to our understanding, used mainly as a supplement for other indicators, something we will test further down in the article.
Western trading owes much to Japanese trading. For example, the candlestick price representation is Japanese, imported to the West around the 1980s. Since the second half of the 1990s, a new “candlestick” representation was imported from Japan to the West, largely thanks to an article written by trader Dan Valcu in 2004. This price representation is called Heikin-Ashi, which means Average-Bar.
Heikin Ashi candlesticks aims to eliminate the “noise” in the prices to bring out the directional component or the consolidation phases. The Heikin-Ashi method has obtained tremendous popularity on the web, but if it is not understood thoroughly, it can lead to trading mistakes.
First, the Heikin-Ashi do not show the real prices, so it is impossible to trade directly on them. The four prices that characterize the candle are not real prices. Something similar also happens with other charting techniques, such as the one called Range Bar and the one called Renko, which you can learn more about in these articles:
To understand the difference, we need to look at how it’s calculated:
How to calculate Heikin Ashi
The formula is not straightforward and is a bit complicated.
Heikin Ashi smooths the candlesticks using average open, high, low, and close values. However, the open and close are calculated differently for Heikin Ashi – it’s not the actual prints, but a mathematical formula is used to make “artificial” values.
As mentioned, the popularity of the Hekin-Ashi method in the West is largely due to trader Dan Valcu who described it in 2004 in an article that appeared in the famous Stocks & Commodities magazine. In this article, he wrote that the Heikin-Ashi values are calculated as follows:
- haClose = (O+H+L+C)/4;
- haOpen = ema(Ref(haClose, -1), 3);
- haHigh = Max(H, haOpen);
- haLow = Min(L, haOpen);
The HAO price is dependent on the previous Heikin Ashi values. Because the open price is the midpoint of the “body” of the previous candle, every Heikin Ashi candle starts at the midpoint of the previous one.
These formulas have been taken for granted for twenty years without realizing that they can be simplified and better understood. Let’s see how and why.
Since haClose is always between H and L, then formulas 3 and 4 are more simply equivalent to the following:
3) haHigh = Maximum(H, haOpen)
4) haLow = Minimum(L, haOpen)
In all these years, no one has noticed this similarity!
Another thing mentioned is the true meaning of haOpen. haOpen is actually an exponential moving average of the previous haClose calculated with a multiplier of 1/2. The formula to get the periods from the multiplier is
Periods = (2 / Multiplier) – 1
so the periods are equal to 3.
Heikin Ashi code for Amibroker
Amibroker doesn’t come with the code for Heikin Ashi, at least not the version we have. In light of what we have written above, the formulas in Amibroker for calculating candlesticks according to the Heikin Ashi method are:
- haClose = (O+H+L+C)/4;
- haOpen = ema(Ref(haClose, -1), 3);
- haHigh = Max(H, haOpen);
- haLow = Min(L, haOpen)
Is Heikin Ashi better than candlesticks?
Heikin-Ashi is a technical indicator plotted as candlesticks, more precisely:
• haClose is the so-called Total Price (the average of the four prices of a candle)
• haOpen is an exponential moving average of the total price
• haHigh and haLow act as resistance and support.
We, therefore, believe that the question of which is better is “nonsense”: candlesticks are about real prices, and Heikin-Ashi is a technical indicator derived from prices and plotted as candlesticks. We will understand this better in the following section.
What does the Heikin Ashi candlesticks look like?
Below is the S&P 500 with standard candlesticks and Heikin Ashi. In the image, you can see a Heikin-Ashi chart. It looks excellent, seems very easy to trade, and you can make a lot of money:
The lower half, which contains the Heikin Ashi, shows blue and red candlesticks. Blue signals a positive trend, while red is bearish. A black and filled candlestick in the upper half doesn’t necessarily translate into a red Heikin Ashi candle.
The main idea with Heikin Ashi candlesticks is to smooth the movements into more reliable trends. The Heikin Ashi above shows fewer blue to red changes than black and white in the original candlestick chart. Blue and red candles flow in patterns or show regularities and trends – at least to the naked eye. Another significant difference is that Heikin Ashi doesn’t offer price gaps.
However, what seems orderly and trending, might not be obvious when we test some quantifiable rules.
Here are a couple of other Heikin Ashi charts:
If you trade on a candle’s opening or closing price, your trade will not be executed at the Heikin-Ashi price. As evident from the charts above, the actual opening and closing prices can be very far from the ones plotted by Heikin-Ashi.
You can see it in the following image, where there are the same Heikin-Ashi candles as in the previous image, with the real prices plotted as overlapping bars. The one sure thing is that Heikin-Ashi always packs the actual bar.
The chart below has Heinin Ashi bars and ordinary bars to spot the difference:
What does Heikin Ashi indicate?
Heikin-Ashi, as the Japanese name itself states, is an average bar. Each bar price is an average price, and you can’t trade on the price (or bar). So the indications it gives us are delayed. Precisely because it’s delayed, it manages to visualize the price trend well and can be a valuable tool for analysts and discretionary traders for trend following strategies.
The arguments for consecutive colored candles seem apparent, but as with any other indicator, Heikin Ashi tells us what has happened in the past. Does it offer any benefits in predicting future movements?
First, let’s make a customization:
Customizable Heikin-Ashi representation
Since we have understood what Heikin-Ashi really is and how to calculate it, we can also propose changing the parameter that regulates the calculation of the Open to filter out more or less noise in the price.
haOpen = ema(Ref(haClose, -1), 3);
The following image shows how a Heikin-Ashi chart changes when the period’s parameter varies from 2 to 9, while on the web is always 3 (please click on the chart to display animated changes in the parameters).
Does Heikin Ashi contain any predictive value?
We use candlesticks in our charts, not because we look for edges, but because we believe it’s easier to grasp the daily action and where prices opened and closed. However, in a previous article, we revealed that some candlestick formations do seem to offer value:
Can we get the same promising results using Heikin Ashi?
Heikin Ashi trend following strategy
Now let’s look at a specific and profitable Heikin Ashi strategy. We apply the following rules:
Buy = Cross( haClose, haOpen ); //haClose crosses above haOpen i.e. candle turns green from red
Sell = Cross( haOpen, haClose );//haClose crosses below haOpen i.e. candle turns red from green
It is a “simple” strategy that we will backtest on the S&P500 index from 1960 to today on a monthly timeframe.
And this is the resulting equity line:
We can think of it as a trend following strategy. We don’t take short trades due to the bullish trend in the stock market (in the long term).
Let’s analyze the trading statistics and metrics:
- 83 trades since 1960
- Annual Return: 4.77% (buy and hold is 7.03%) – not including dividends
- The average gain per trade is 4.31%
- 49.4% of the trades are winners
- You are invested 66.76% of the time
- Max drawdown is 29.89% (buy and hold 52.56%)
- Risk-adjusted return is 7.15% (4.77% divided by 0.6676) (buy and hold 7.03%)
The low win ratio (49.4%) is typical of a trend-following trading system, but it’s not so low for our strategy. The performance metrics are good, and considering that the Heiki-Ashi were developed long ago, the results can be considered out of sample.
Here is the profit/loss distribution. It provides insight into how the trading system works:
As we might expect, we find a favorable asymmetric profit/loss distribution. The opposite is a negatively skewed profit distribution – typical for a mean reversion strategy.
Heikin Ashi and ADX trading strategy
We also tried some trading rules that included the ADX-indicator:
Because stock indices tend to revert to the mean, we backtest by entering at the close after two red Heikin Ashi candles. Additionally, we use an x-day filter of the ADX (test yourself for different parameters). The exit is on a day when the close is higher than yesterday’s high.
On the S&P 500, we get this equity chart:
CAGR is 5.27%, but exposure is only 5% (time spent in the market).
However, consumer staples (XLP) seem much better, but the average per trade is a low 0.22%.
Heikin Ashi strategy – conclusion:
Heikin Ashi works, but mostly on long time frames. We have shown you several profitable Heikin Ashi strategies and thus given you a greater understanding of Heikin Ashi and what it can do for us.
Since we are more interested in quantified strategies, we tried backtesting a straightforward strategy and found it works well. We also proposed a way to customize Heikin-Ashi to filter out noise.
For more strategies, please visit our landing page, which has almost 200 potential trading ideas:
FAQ:
What is Heikin Ashi candlesticks?
Heikin Ashi is a Japanese candlestick charting technique aimed at highlighting trends or consolidation phases by smoothing price movements. Unlike traditional candlesticks, Heikin Ashi uses averages, and its representation is designed to reduce noise in price action.
Is Heikin Ashi better than traditional candlesticks, and what are its advantages?
Heikin Ashi and traditional candlesticks serve different purposes. While candlesticks represent real prices, Heikin Ashi is a derived indicator aiming to smooth price movements. Heikin Ashi is considered a lagging indicator, offering indications based on past price movements.
What is the profitability of the Heikin Ashi trend-following strategy?
The strategy, being trend-following, is designed to capture prolonged market trends. This aligns with the nature of Heikin Ashi, which aims to smooth price movements and highlight trends. While the win ratio might seem moderate, the strategy’s overall performance metrics, risk-adjusted return, and positive equity growth make it a noteworthy trend-following approach. It’s essential to consider that the strategy, like any trading system, has its strengths and limitations. Traders may need to assess its compatibility with their risk tolerance and overall trading objectives.
Heikin Ashi Trading Glossary
- Bullish: A market condition where prices are rising.
- Bearish: A market condition where prices are falling.
- Candlestick: A graphical representation of price movement.
- Doji: A candlestick pattern indicating indecision.
- EMA (Exponential Moving Average): A type of moving average that gives more weight to recent prices.
- Fibonacci Retracement: A tool used to identify potential support and resistance levels.
- Gravestone Doji: A bearish reversal candlestick pattern.
- Hammer: A bullish reversal candlestick pattern.
- Heikin Ashi: A charting technique that uses modified candlesticks to filter noise.
- Ichimoku Cloud: A comprehensive trading indicator.
- Inside Bar: A candlestick pattern indicating consolidation.
- Lagging Indicator: An indicator that follows price movements.
- Leading Indicator: An indicator that predicts future price movements.
- MACD (Moving Average Convergence Divergence): A trend-following momentum indicator.
- Morning Star: A bullish reversal candlestick pattern.
- Moving Average: A statistical calculation of average prices.
- Oscillator: An indicator that oscillates above and below a central line.
- Parabolic SAR: A trend-following indicator.
- Pivot Point: A support and resistance level used in trading.
- Range: The difference between the high and low prices.
- Relative Strength Index (RSI): A momentum oscillator.
- Resistance: A price level where selling pressure is expected.
- Rogue Wave: A rare and strong Heikin Ashi reversal pattern.
- Scalping: A trading strategy focused on small, quick profits.
- Shooting Star: A bearish reversal candlestick pattern.
- Support: A price level where buying interest is expected.
- Swing Trading: A trading strategy that aims to capture short- to medium-term price swings.
- Trendline: A line drawn to represent a trend.
- Volume: The number of shares or contracts traded.
- Whipsaw: A situation where a trader is caught in a series of quick, adverse price movements.
- ADX (Average Directional Index): A trend strength indicator.
- Aroon Oscillator: A momentum oscillator used to identify trend changes.
- Bullish Engulfing: A bullish reversal candlestick pattern.
- Candlestick Pattern: A specific arrangement of candlesticks.
- Dark Cloud Cover: A bearish reversal candlestick pattern.
- Engulfing Pattern: A two-candlestick pattern indicating a potential reversal.
- Fibonacci Extension: A tool used to identify potential price targets.
- Gap: A price jump between two trading sessions.
- Hanging Man: A bearish reversal candlestick pattern.
- Ichimoku Tenkan Sen: The Tenkan Sen line in the Ichimoku Cloud.
- Inverted Hammer: A bullish reversal candlestick pattern.
- Leverage: Borrowed capital used to increase trading position size.
- Margin: Collateral required to trade with leverage.
- Moving Average Crossover: A signal generated when two moving averages cross.
- Piercing Pattern: A bullish reversal candlestick pattern.
- RSI Divergence: A discrepancy between RSI and price movement.
- Scalp Trader: A trader who specializes in scalping.
- Stochastic Oscillator: A momentum indicator measuring overbought and oversold conditions.
- Support and Resistance Zones: Price levels where supply and demand interact.
- VWAP (Volume Weighted Average Price): A trading indicator based on volume and price.