Q:

How to correctly plot Renko bars?

I want to plot ATR based renko bars.
I have code:
//@version=3
study("RENKO INDICATOR", overlay=false)

renko_atr = input(20, title="Use Renko ATR")

renko_BTC = renko(tickerid, "close", "ATR", renko_atr)

renko_BTC_close = security(renko_BTC, period, close)
renko_BTC_open = security(renko_BTC, period, open)

col = renko_BTC_close > renko_BTC_open ? lime: red

renko_wick = renko_BTC_open > renko_BTC_close ? renko_BTC_close : renko_BTC_open
r1 = plot(renko_BTC_close, color=col)
r2 = plot(renko_BTC_open, color=col)

fill(r1,r2, color=col)
plotcandle(renko_BTC_open,renko_wick,renko_wick,renko_BTC_close, color=col)

As you can see from the picture, my bars are different from TradingView bars. Why is this happening? And how to fix it?

A:

You can't, this is because a renko chart has not a fixed time interval, a brick will only appear once a condition is met, however if you try to plot a renko in a standard candle chart where the time interval is fixed then you'll see values of the renko equal to their precedent values.
A solution might be to use some kind of offset in order to remove all renko values equal to their precedent values, I don't know if such solution is possible to implement, and its not that useful.

