Skip to main content
Track Heikin-Ashi
7 / 16
Library

2008issue C121-7

How a Heikin-Ashi candlestick oscillator is built from color, lag, and hold rules

This article reconstructs how Heikin-Ashi color, a zero-lag close comparison, and keep rules are assembled into a binary oscillator that flips to an up or down state and otherwise holds the prior state.

  • A Heikin-Ashi close at or above its reconstructed open paints the ordinary candle green, and the red paint runs only when that green test is not true.
  • Oscillator state is assembled from a two-bar Heikin-Ashi color alert, a zero-lag close-minus-Heikin-Ashi difference, and a keep-all persistence test.
  • A third keep rule can hold an up state when the real body is less than 35 percent of the high-low range and the high is at or above the prior low.
  • The published result is binary: it flips to 1 on an up-turn, to 0 on a down-turn, and otherwise stays at the previous state.
Entries in this reading3 entries

What HACO assembles

HACO, the Heikin-Ashi candlestick oscillator, is a binary up-or-down state built from Heikin-Ashi color, a smoothed close comparison, and extra hold rules that delay flips on small-bodied bars.

Heikin-Ashi is a reconstructed candle whose open, high, low, and close are averaged from the current bar and the prior reconstructed open so that consecutive bars share a common trend color.

How the reconstructed open and close are defined

The Heikin-Ashi open is defined as the average of the prior typical price and the previous Heikin-Ashi open. The Heikin-Ashi close averages the typical price, that open, and the max and min of high and that open.

How ordinary candles are painted

A Heikin-Ashi close at or above its reconstructed open is used to paint the ordinary candle green. A Heikin-Ashi close below that open is used to paint it red.

Green highlight evaluation is given priority so the red formula runs only when the green condition is not true.

How oscillator state is assembled

The oscillator state is assembled from a two-bar Heikin-Ashi color alert, a zero-lag close-minus-Heikin-Ashi difference, and a keep-all persistence test that can remain true when the current close still agrees with the prior keep state.

The zero-lag difference is the gap between a twice-smoothed midpoint series plus its first-minus-second difference and the matching smoothed Heikin-Ashi close. Exponential smoothing in this construction is a repeated triple exponential average applied to midpoints and then differenced to produce a zero-lag close that can be compared with a similarly smoothed Heikin-Ashi close.

Keep-all is a persistence rule that remains true when the current bar still agrees with the prior keep state by closing in the same direction or above or below the prior close.

A third keep condition treats a small real body, less than 35 percent of the high-low range, together with a high that is at or above the prior low, as extra evidence to hold an up state.

What the procedure outputs

The published procedure outputs a binary result that flips to 1 on an up-turn, to 0 on a down-turn, and otherwise stays at the previous state.

The source displays the finished oscillator as long positions in green and short positions in red on a 2004 price chart.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
7 of 16 in the Heikin-Ashi track
20081-12 pp.Next on Heikin-AshiHeikin-Ashi color-coded candles and smoothed trend filtersA Heikin-Ashi open can be built as the average of the prior Heikin-Ashi open and the prior four-price typical price, which is an exponential-style recursion on OHLC structure.
All readings on this track · 16 readings
  1. 2004Reconstructing Heikin-Ashi bars from smoothed OHLC
  2. 2004Heikin-Ashi candle construction as an OHLC transform
  3. 2004Stacking heikin-ashi, swing charts, and a moving average in strong trends
  4. 2007Constructing a Heikin-Ashi volume-price oscillator
  5. 2007A volume-price oscillator is a timing trigger, not a standalone entry
  6. 2008Heikin-Ashi OHLC construction and simplification
  7. 2008How a Heikin-Ashi candlestick oscillator is built from color, lag, and hold rules
  8. 2008Heikin-Ashi color-coded candles and smoothed trend filters
  9. 2010Heikin-Ashi smoothed percent b for divergence timing
  10. 2011Constructing Heikin-Ashi, moving-average, and MACD filters
  11. 2011Constructing candlestick, Elliott-wave, and Heikin-Ashi hypotheses
  12. 2012Constructing a three-state Heikin-Ashi trend filter
  13. 2012Heikin-ashi as a trend-state signal without candlestick-patterns
  14. 2013Heikin-Ashi volume gates, smoothing, and denominator floors
  15. 2013How Heikin-Ashi close and typical-price form a two-average crossover
  16. 2013Walk-forward tests for color-coded Heikin-Ashi crosses
All 17 readings tagged Heikin-Ashi
Also on Heikin-Ashi5 readings