# Renko
# Mobius
input brickSize = 5;
def c = close;
def bricks = CompoundValue(1, if c > bricks[1] + brickSize
then bricks[1] + brickSize
else if c < bricks[1] - brickSize
then bricks[1] - brickSize
else bricks[1] , bricks[1]);
plot bricks_ = Round(Bricks/TickSize(),0) * TickSize();
def mortar = CompoundValue(1, if bricks_ != bricks_[1]
then bricks_[1]
else mortar[1], mortar[1]);
plot mortar_ = Round(mortar/TickSize(),0) * TickSize();
AddCloud(bricks_, mortar_, color.green, color.red, yes);
# End Code
#input BrickSize = 1.25;
input BrickTicks = 10.0;
#def BrickTicks = reference ATR();
input label = Yes;
def BrickSize = BrickTicks * TickSize();
def Mortar = CompoundValue(1, if close() > Mortar[1] + BrickSize
then Mortar[1] + BrickSize
else if close() < Mortar[1] - BrickSize then Mortar[1] - BrickSize else Mortar[1] , close());
def Stack = if Mortar != Mortar[1] then Mortar[1] else Stack[1];
def mortarext = if IsNaN(close) then mortarext[1] else Mortar;
def stackext = if IsNaN(close) then stackext[1] else Stack;
plot Bricks = Mortar; plot Renko = Stack;
#plot Bricksext = mortarext;
#plot Renkoext = stackext;
input showcloud = yes;
def same=if same[1]==0 and bricks>bricks[1] and bricks>renko[1] then 1 else if same[1]==1 and max(renko,bricks)>=max(renko[1],bricks[1]) then 1 else 0;
def s1= if isnan(close) then s1[1] else same;
def s=s1;
defineglobalColor("UP", color.green);
defineglobalcolor("DN", color.red);
addcloud(if showcloud and s==1 then bricks else double.nan, renko, globalcolor("UP"),globalcolor("UP"));
addcloud(if showcloud and s==0 then renko else double.nan, bricks, globalcolor("DN"),globalcolor("DN"));
plot stoploss = if !isnan(close) then double.nan else if s==0 then max(mortarext,stackext) + ticksize() else min(mortarext,stackext) - ticksize();
#Bricks.AssignValueColor(if Bricks > Renko then Color.green else Color.red);
Bricks.AssignValueColor(if s==1 then Color.green else Color.red);
Renko.AssignValueColor(if s==1 then Color.green else Color.red);
#Bricksext.AssignValueColor(if (Bricksext) > (Renkoext) then Color.GREEN else Color.RED);
#Renkoext.AssignValueColor(if (Bricksext) > (Renkoext) then Color.GREEN else Color.RED);
AddLabel(label, "Renko: " + BrickSize, if Bricks > Renko then Color.GREEN else Color.RED);
input pricecolor = no;
AssignPriceColor(if pricecolor == no then Color.CURRENT else if s==1 then Color.green else Color.red);
# Renko Bar Time
# Mobius
# Chat Room Request 09.03.2019
def lastBar = if isNaN(close[-1]) and !isNaN(close)
then barNumber()
else lastBar[1];
def thist = if barNumber() == lastbar
then getTime()
else thist[1];
def lastt = if barNumber() != lastBar
then getTime()
else lastt[1];
def elapsed = (thist - lastt)/1000/60;
addLabel(1, "elapsed time min: " + elapsed, color.white);
One or two videos on YouTube explain the importance of setting the Renko Bars,....depending on what's being traded, ETf, futures, stock...Does anyone here use Renko Bars and if so what type of indicators have you paired with them?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.