Sidechair

ticker.heikinashi()

Browse the reference

Builds a ticker id that serves Heikin Ashi candles for a symbol, to pass to request.security.

Try it in the editor

ticker.heikinashi(symbol) does not fetch any data itself. It returns a string that names the Heikin Ashi version of the symbol. Give that string to request.security and the requested series is built from Heikin Ashi bars: open, high, low and close are the smoothed values, not the real prices.

Heikin Ashi close is the average of the real open, high, low and close of the bar. The open is the midpoint of the previous Heikin Ashi bar. That smoothing hides noise and also hides real prices, so never use these values as fill prices.

Syntax

Pine Script
ticker.heikinashi(symbol: simple string) -> simple string
ticker.heikinashi(symbol: series string) -> series string

Arguments

NameTypeDefaultDescription
symbolsimple/series stringrequiredThe ticker id to convert, such as syminfo.tickerid or "NASDAQ:AAPL".

Returns

simple/series string: A ticker id string. Pass it to request.security as its symbol argument.

Remarks

  • A strategy that trades on a Heikin Ashi chart sees smoothed prices in its signals but fills at real ones. Request the Heikin Ashi series to get its signal and keep orders on the chart's own symbol.

Example

Pine ScriptHeikin Ashi close against the real closeOpen in editor
//@version=6
indicator("Heikin Ashi close", overlay = true)
haId = ticker.heikinashi(syminfo.tickerid)
haClose = request.security(haId, timeframe.period, close)
plot(close, "Close", color.gray)
plot(haClose, "Heikin Ashi close", color.orange)
plot(ohlc4, "Same value computed by hand", color.new(color.blue, 70))

See also

Runs on Sidechair