Free lesson · Technical analysis
Heikin-Ashi: smoothed candles are synthetic prices
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Heikin-Ashi replaces ordinary candle values with averages. This changes the displayed path and can introduce lag.
Symbols, units & horizon
- O_t,H_t,L_t,C_t: real bar prices in matching units
- superscript HA: derived Heikin-Ashi value, not an executable quote
- t−1: prior completed bar
- max,min: enclosing high and low
When and why to use this
Use synthetic-bar persistence as a candidate trend-state feature, with a real-price execution ledger.
- Compute the synthetic close from the current real OHLC average. Compute the synthetic open from the preceding Heikin-Ashi open and close.
- Seed the first synthetic open explicitly; this lesson uses the first real open/close midpoint.
- The synthetic high/low enclose both synthetic open/close and the real extremes.
- Repeated same-color synthetic candles may describe persistence in the smoothing rule. Test a trend filter against simpler moving averages.
- Use Heikin-Ashi only for features or visualization; reconcile orders and fills with real executable prices.
- Never backtest fills at synthetic opens, closes or intermediate prices merely because the chart displays them.
Heikin-Ashi: smoothed candles are synthetic prices
- For real OHLC [100,106,98,104], synthetic close=(100+106+98+104)/4=102.
- If previous HA open=99 and close=101, the current HA open=(99+101)/2=100.
- Synthetic high=max(106,100,102)=106; low=min(98,100,102)=98.
The displayed close 102 differs from the real close 104. A feature may use 102; a fill requires a real price available after the decision.
Use the rule
- Fix the definition, units and information timestamp.
- Compute the example and inspect the graph.
- Compare with a simple baseline on untouched periods after costs.
Before moving on
Write the exact rule, its availability time, an invalidation condition and a fair out-of-sample test.
- Research context: review the related evidence checkpoint. The numerical convention here defines a candidate feature; that related research does not validate this exact rule.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
def heikin_ashi(bars):
result=[]
for o,h,l,c in bars:
if not l<=min(o,c)<=max(o,c)<=h: raise ValueError("Invalid OHLC")
close=(o+h+l+c)/4
opening=(result[-1][0]+result[-1][3])/2 if result else (o+c)/2
result.append((opening,max(h,opening,close),min(l,opening,close),close))
return result
print(heikin_ashi([(100,106,98,104)]))Continue learning
Technical Analysis: Geometry, Structure & Evidence — all lessons- Support, resistance and reversal: start with a price zone
- Breakout detection, false breaks and retests
- Fibonacci retracements: anchors before ratios
- Harmonic patterns: ratio constraints and competing candidates
- Elliott Wave: count hypotheses, rules and invalidation
- Fair value gaps (FVG): three-bar geometry and fill measurement
- Heikin-Ashi: smoothed candles are synthetic prices
- Renko: price-driven bricks and the missing time axis
- Dynamic support, trend lines and Gann angles
- Momentum indicators, oscillators and divergence
- Volume, supply/demand zones and what OHLCV cannot reveal
- Market structure, BOS and CHOCH as a state machine
- Moon phases: encode a calendar hypothesis and try to falsify it
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations