Renko Compatible Previous H/L and Globex

beerguyster

New member
I cant seem to find a renko compatible indicator that draws previous day high/low and globex. I found a Mobius code that does globex and is renko compatible and tried to add previous high/low with my limited knowledge. It works great afterhours but after the open it draws current days high/low. Dont know how to change this line and make it still work with renko brinks. "def RTH =GetTime() > RegularTradingstart(GetYYYYMMDD());" Ideal code would be something I can copy/paste/edit and get to print separate high/low lines going back more then one day. Thanks in advance.

#Renko Compatible
#Over Night High/Low and Previous High/Low
#Mobius Code Modified

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 ONH = if OverNightHigh > 0
then OverNightHigh
else Double.NaN;
ONH.SetPaintingStrategy(PaintingStrategy.DASHES);
ONH.SetDefaultColor(createColor(153,255,153));
ONH.HideBubble();
ONH.HideTitle();
ONH.SetLineWeight (3);

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

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

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

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

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

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

plot PREV_Low = if DayLow > 0
then DayLow
else Double.NaN;
PREV_Low.SetPaintingStrategy(PaintingStrategy.DASHES);
PREV_Low.SetDefaultColor(Color.DARK_RED);
PREV_Low.HideBubble();
PREV_Low.HideTitle();
PREV_Low.SetLineWeight (3);
 
Solution
This code fixes the dilemma I just can't get it to search previous day. Globex high and low works great.

Here are the /ES 10D 20 tick renko charts, both using the following code, which plots 3 prior days reg trading hours H/Ls. You can add more days by using the logic for the 3 days.

The upper pane in the following image is the 3 days H/Ls with todayonly == yes shown on the current day. The lower pane is todayonly == no and shows the same 3 days developing H/Ls.

Capture.jpg
Ruby:
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...
You likely can't find any indicator for a daily high/low for renko because you're assigning a time-based indicator to a non-time-based chart. Depending on your price range for your renko bar, you could go days without creating a new bar (or whatever time-based value you're trying to assign the indicator to) So, even if there is a way to fudge the data to plot, it's irrelevant in regards to renko.
 

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

You likely can't find any indicator for a daily high/low for renko because you're assigning a time-based indicator to a non-time-based chart. Depending on your price range for your renko bar, you could go days without creating a new bar (or whatever time-based value you're trying to assign the indicator to) So, even if there is a way to fudge the data to plot, it's irrelevant in regards to renko.
This code fixes the dilemma I just can't get it to search previous day. Globex high and low works great.
 
This code fixes the dilemma I just can't get it to search previous day. Globex high and low works great.

Here are the /ES 10D 20 tick renko charts, both using the following code, which plots 3 prior days reg trading hours H/Ls. You can add more days by using the logic for the 3 days.

The upper pane in the following image is the 3 days H/Ls with todayonly == yes shown on the current day. The lower pane is todayonly == no and shows the same 3 days developing H/Ls.

Capture.jpg
Ruby:
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 = yes;
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.RED);
DefineGlobalColor("L", Color.GREEN);
H1.SetDefaultColor(GlobalColor("H"));
H2.SetDefaultColor(GlobalColor("H"));
H3.SetDefaultColor(GlobalColor("H"));

L1.SetDefaultColor(GlobalColor("L"));
L2.SetDefaultColor(GlobalColor("L"));
L3.SetDefaultColor(GlobalColor("L"));

input bubbles = yes;
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);
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
340 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