Zack_The_Lego

Flex Renko Emulator

update:
As far as my algorithm design will take me this is it. So It's complete in my eyes. Here is a "working" version of something I've been looking for for a long time: "Flex" Renko Charting.
Bricks' sizes are determined by ATR and are set by simply choosing a resolution for the ATR calculation. No need to go in and choose renko granulation(resolution) AND brick size. Renko granulation is current chart resolution. Feel free to send me feedback on how to manage the reversal bricks' calculation or any other thoughts and ideas.

Replace the "close" in the main body of the renko calculation with 'high' and 'low' to get more consistent paintings across different aggregations since renkos aren't technically based off closing prices but where the price has been. Of course it's all a matter of preference:
Brick1 = high >
nz(Brick1) + BrickSize ? nz(Brick1) + BrickSize : low <
nz(Brick1) - BrickSize ?
nz(Brick1) - BrickSize
: nz(Brick1)


Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Zack_the_Lego
study("Flex Renko Emulator", overlay = true)
res = input(type=resolution, defval = "D", title = "Resolution of ATR")
xATR = atr(14)
//TF = x78tf ? "78" : "39"
BrickSize = security(tickerid,res, xATR)

Brick1    =  close >
        nz(Brick1[1]) + BrickSize ? nz(Brick1[1]) + BrickSize : close <
                    nz(Brick1[1]) - BrickSize ?
                        nz(Brick1[1]) - BrickSize
                            : nz(Brick1[1])
                            
Brick2 = Brick1 != Brick1[1] ? Brick1[1] : nz(Brick2[1])
colorer = Brick1 > Brick2 ? green:red
p1=plot(Brick1, color = colorer, linewidth= 4, title = "Renko")
p2=plot(Brick2, color = colorer, linewidth= 4, title = "Renko")
fill(p1,p2, color = purple, transp= 50)