Heikin Ashi transforms raw OHLC candles into a smoothed variant that
filters out market noise. The transform is purely local — each HA
candle depends only on the current raw candle and the previous HA
candle — so it can be streamed incrementally.
Formulas:
HA.close = (o + h + l + c) / 4
HA.open = (prev HA.open + prev HA.close) / 2 (first: (o + c) / 2)
HA.high = max(raw.high, HA.open, HA.close)
HA.low = min(raw.low, HA.open, HA.close)
The timestamps and volumes are copied verbatim from the raw input.
Usage pattern: transform your full candle array, then feed the
result into OHLCVChart.setData(). For live updates, call
advanceHeikinAshi(prevHA, rawCandle) with the latest raw candle.
Heikin Ashi transforms raw OHLC candles into a smoothed variant that filters out market noise. The transform is purely local — each HA candle depends only on the current raw candle and the previous HA candle — so it can be streamed incrementally.
Formulas: HA.close = (o + h + l + c) / 4 HA.open = (prev HA.open + prev HA.close) / 2 (first: (o + c) / 2) HA.high = max(raw.high, HA.open, HA.close) HA.low = min(raw.low, HA.open, HA.close)
The timestamps and volumes are copied verbatim from the raw input.
Usage pattern: transform your full candle array, then feed the result into
OHLCVChart.setData(). For live updates, calladvanceHeikinAshi(prevHA, rawCandle)with the latest raw candle.