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)


开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//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)