I want to plot difference between current Heikin Ashi (HA) close price and real close price (on normal candles) in Pine script 3.
Seems like it can work if I use normal candles on chart but if I use Heikin Ashi, I get HA close price instead of normal one.
HAclose = security(heikinashi(tickerid), period, close)
NormalClose = security(tickerid, period, close)
plot(HAclose, offset=1, show_last=1)
plot(NormalClose, offset=1, show_last=1)
The code above is expected to draw two lines in front of last candle, showing HA close and normal close. It does if chart is set to normal candles, but on HA candles those have same value -- HA close. Same if I use just close
.
Is there a way to explicitly address price on normal candles?
security("BITMEX:ETHUSD", period, close)
. Maybe HA changestickerid
somehow? I could parse it back maybe but not sure if Pine is capable of it. Maybe constructtickerid
out ofticker
and something else? – Helyrk