Builds a ticker id that serves Heikin Ashi candles for a symbol, to pass to request.security.
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
ticker.heikinashi(symbol: simple string) -> simple string
ticker.heikinashi(symbol: series string) -> series stringArguments
| Name | Type | Default | Description |
|---|---|---|---|
| symbol | simple/ | required | The 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
//@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