Renko Brick Overnight, Current, & Previous 3 day High/Low For ThinkOrSwim

beerguyster

New member
After wasting some time and with the help of SleepyZ and Mobius code I got a indicator that will draw high and low lines on a renko brick chart for Current day, Over Night, and the Previous 3 days. Slow computers may not like this one. Well now I contributed something for all the awesome code I got off this forum over the last year.


#Renko Compatible
#Over Night High/Low, Current High/Low, and Previous 3 day High/Low
#Mobuis Globex Code Modified
#SleepyZ script added
#Put together half *** by Beerguyster


######################################################
#Mobuis Globex Code modified with Current day High/Low
######################################################

def o = open;
def h = high;
def l = low;
def c = close;
def v = volume;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def RTH =GetTime() > RegularTradingstart(GetYYYYMMDD());

def ONhigh = if GlobeX and !GlobeX[1]
then h
else if GlobeX and
h > ONhigh[1]
then h
else ONhigh[1];

def ONhighBar = if GlobeX and h == ONhigh
then bar
else Double.NaN;

def ONlow = if GlobeX and !GlobeX[1]
then l
else if GlobeX and
l < ONlow[1]
then l
else ONlow[1];

def ONlowBar = if GlobeX and l == ONlow
then bar
else Double.NaN;

def OverNightHigh = if BarNumber() == HighestAll(ONhighBar)
then ONhigh
else OverNightHigh[1];
def OverNightLow = if BarNumber() == HighestAll(ONlowBar)
then ONlow
else OverNightLow[1];
plot Globex_High = if OverNightHigh > 0
then OverNightHigh
else Double.NaN;
Globex_High.SetPaintingStrategy(PaintingStrategy.DASHES);
Globex_High.SetDefaultColor(createColor(153,255,153));
Globex_High.HideBubble();
Globex_High.HideTitle();
Globex_High.SetLineWeight (3);

plot Globex_Low = if OverNightLow > 0
then OverNightLow
else Double.NaN;
Globex_Low.SetPaintingStrategy(PaintingStrategy.DASHES);
Globex_Low.SetDefaultColor(Color.pink);
Globex_Low.HideBubble();
Globex_Low.HideTitle();
Globex_Low.SetLineWeight (3);

def CurrHigh = if RTH and !RTH[1]
then h
else if RTH and
h > CurrHigh[1]
then h
else CurrHigh[1];

def HighBar = if RTH and h == CurrHigh
then bar
else Double.NaN;

def CurrLow = if RTH and !RTH[1]
then l
else if RTH and
l < CurrLow[1]
then l
else CurrLow[1];

def LowBar = if RTH and l == CurrLow
then bar
else Double.NaN;

def DayHigh = if BarNumber() == HighestAll(HighBar)
then CurrHigh
else DayHigh[1];
def DayLow = if BarNumber() == HighestAll(LowBar)
then CurrLow
else DayLow[1];
plot High = if DayHigh > 0
then DayHigh
else Double.NaN;
High.SetPaintingStrategy(PaintingStrategy.DASHES);
High.SetDefaultColor(Color.DARK_GREEN);
High.HideBubble();
High.HideTitle();
High.SetLineWeight (3);

plot Low = if DayLow > 0
then DayLow
else Double.NaN;
Low.SetPaintingStrategy(PaintingStrategy.DASHES);
Low.SetDefaultColor(Color.DARK_RED);
Low.HideBubble();
Low.HideTitle();
Low.SetLineWeight (3);

###########################################
#SleepyZ script for Previous 3 day High/Low
###########################################

script philow {
input n = 1;
def ymd = GetYYYYMMDD();
def ok = !IsNaN(close);
def capture = ok and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture
then dayCount[1] + 1
else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;

def hh = CompoundValue(1, if thisDay == n and gettime() crosses above regularTradingStart(getyyyYMMDD())
then high
else if thisDay == n and high > hh[1]
then high
else hh[1] , high);
def hhnan = if IsNaN(close) then hhnan[1] else hh;
plot hhplot = if thisDay == n and SecondsFromTime(0930) < 0
then Double.NaN
else if thisDay <= n
then hhnan
else Double.NaN;

def ll = CompoundValue(1, if thisDay == n and GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
then low
else if thisDay == n and low < ll[1]
then low
else ll[1] , low);
def llnan = if IsNaN(ll) then llnan[1] else ll;
plot llplot = if thisDay == n and SecondsFromTime(0930) < 0
then Double.NaN
else if thisDay <= n
then (llnan)
else Double.NaN;
}

#Plots of Highs/Lows based upon script...add more days using similar plot statements, increasing the value by 1
input todayonly = no;
def ymd = GetYYYYMMDD();
def ok = !IsNaN(close);
def capture = ok and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture
then dayCount[1] + 1
else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;

plot H1 = if todayonly and thisDay > 0 then Double.NaN else philow(1);
plot H2 = if todayonly and thisDay > 0 then Double.NaN else philow(2);
plot H3 = if todayonly and thisDay > 0 then Double.NaN else philow(3);

plot L1 = if todayonly and thisDay > 0 then Double.NaN else philow(1).llplot;
plot L2 = if todayonly and thisDay > 0 then Double.NaN else philow(2).llplot;
plot L3 = if todayonly and thisDay > 0 then Double.NaN else philow(3).llplot;

DefineGlobalColor("H", Color.Green);
DefineGlobalColor("L", Color.Red);
H1.SetDefaultColor(GlobalColor("H"));
H1.SetPaintingStrategy(PaintingStrategy.DASHES);
H1.HideBubble();
H1.HideTitle();
H1.SetLineWeight (3);

H2.SetDefaultColor(GlobalColor("H"));
H2.SetPaintingStrategy(PaintingStrategy.DASHES);
H2.HideBubble();
H2.HideTitle();
H2.SetLineWeight (3);

H3.SetDefaultColor(GlobalColor("H"));
H3.SetPaintingStrategy(PaintingStrategy.DASHES);
H3.HideBubble();
H3.HideTitle();
H3.SetLineWeight (3);

L1.SetDefaultColor(GlobalColor("L"));
L1.SetPaintingStrategy(PaintingStrategy.DASHES);
L1.HideBubble();
L1.HideTitle();
L1.SetLineWeight (3);

L2.SetDefaultColor(GlobalColor("L"));
L2.SetPaintingStrategy(PaintingStrategy.DASHES);
L2.HideBubble();
L2.HideTitle();
L2.SetLineWeight (3);

L3.SetDefaultColor(GlobalColor("L"));
L3.SetPaintingStrategy(PaintingStrategy.DASHES);
L3.HideBubble();
L3.HideTitle();
L3.SetLineWeight (3);

###########
#Bubbles Yo
###########

input bubbles = no;
input bubblemover = 3;
def bm = bubblemover;
def bm1 = bm + 1;

AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), H1, "H1", H1.TakeValueColor());
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), H2, "H2", H2.TakeValueColor());
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), H3, "H3", H3.TakeValueColor());

AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), L1, "L1", L1.TakeValueColor(), no);
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), L2, "L2", L2.TakeValueColor(), no);
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), L3, "L3", L3.TakeValueColor(), no);

AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), High, "High", High.TakeValueColor());
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), Low, "Low", Low.TakeValueColor(),no);
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), Globex_High, "ONH", Globex_High.TakeValueColor());
AddChartBubble(bubbles and IsNaN(close[bm]) and !IsNaN(close[bm1]), Globex_Low, "ONL", Globex_low.TakeValueColor(),no);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

After wasting some time and with the help of SleepyZ and Mobius code I got a indicator that will draw high and low lines on a renko brick chart for Current day, Over Night, and the Previous 3 days. Slow computers may not like this one. Well now I contributed something for all the awesome code I got off this forum over the last year.
@beerguyster thanks for your sharing...will this work on candlestick chart? thanks
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
420 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top