Globex Levels With Fibonacci (Fibs) For ThinkOrSwim

FutureTony

Well-known member
VIP
Hello friends,

I am back today with a bit of a different take on overnight trading levels. This study is intended for daytrading futures and tracks the highs/lows of the globex session and auto-plots fibs (and extensions) based on those levels.

h4MRCaC.png


There is another study that is a bit more precise in the plotting of the highs and lows from the exact high and low candle but it recursively scans the entire chart, making it taxing on your system. This one is a bit lighter weight and has 3 options for when the levels print - at RTH open, at a timed start or always. I find the 'always' setting gets a bit messy and prefer to usually start at RTH. The fib levels are customizable and default to .618 and .236.
As with most indicators, context is king. Where are we opening - near the globex highs, right in the middle? These are clues to where price might go next. Add this to your chart and watch typical behaviour. The number of times we revisit the highs and lows each day might surprise you.
Ruby:
# Overnight trading range with Fibs
# Created by @tony_futures
#
input displayType = { "At timed start", default  "From RTH Start", "Always"};
input Start_Time = 0800;
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def RTH = GetTime() >= RegularTradingStart(GetYYYYMMDD());
def Today = if GetLastDay() == GetDay() then 1 else 0;

def ONhigh = if GlobeX and !Globex[1] then high else if Globex and high > ONhigh[1] then high else ONhigh[1];
def ONlow = if GlobeX and !GlobeX[1] then low else if GlobeX and low < ONlow[1] then low else ONlow[1];

def showBubbleNow = !IsNaN(close) and IsNaN(close[-1]);
input showBubbles = yes;
AddChartBubble(showBubbles and showBubbleNow[1], ONHigh[1], "Globex High", Color.GRAY, yes);
AddChartBubble(showBubbles and showBubbleNow[1], ONLow[1], "Globex Low", Color.GRAY, no);

# setup Colors
DefineGlobalColor("openColor", CreateColor(169, 169, 169));
DefineGlobalColor("midColor", CreateColor(94, 110, 59));
DefineGlobalColor("fibColor", CreateColor(28, 96, 109));
DefineGlobalColor("fibColor2", CreateColor(109, 84, 44));

input GlobexFibs = yes;
def NAN = Double.NaN;
input RoundLevel = 0;
input globexFibAmt = 0.618;
input showglobexFib1 = yes;
input showglobexMid = yes;
input showglobexFib1Extensions = no;
def globexFib1 = Round(ONLow + ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
def globexFib2 = Round(ONHigh - ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
plot globexFib1Line = if GlobexFibs and showglobexFib1 and Today and RTH then globexFib1 else NAN;
globexFib1Line.setDefaultColor(GlobalColor("fibColor"));
globexFib1Line.hideBubble();

plot globexFib2Line = if GlobexFibs and showglobexFib1 and Today and RTH then globexFib2 else NAN;
globexFib2Line.setDefaultColor(GlobalColor("fibColor"));
globexFib2Line.hideBubble();
def globexMid = Round(ONHigh - ((ONHigh - ONLow) /2),RoundLevel);
plot globexMidLine = if GlobexFibs and showglobexMid and Today and RTH then globexMid else NAN;
globexMidLine.setDefaultColor(GlobalColor("midColor"));
globexMidLine.hideBubble();
def globexFib3 = Round(ONHigh + ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
plot globexFib3Line = if GlobexFibs and showglobexFib1Extensions and Today and RTH then globexFib3 else NAN;
globexFib3Line.setDefaultColor(GlobalColor("fibColor"));
globexFib3Line.hideBubble();
def globexFib4 = Round(ONLow - ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
plot globexFib4Line = if GlobexFibs and showglobexFib1Extensions and Today and RTH then globexFib4 else NAN;
globexFib4Line.setDefaultColor(GlobalColor("fibColor"));
globexFib4Line.hideBubble();

input globexFibAmt2 = 0.236;
input showglobexFib2 = yes;
def globexFib5 = Round(ONHigh - ((ONHigh - ONLow) * globexFibAmt2),RoundLevel);
plot globexFib5Line = if GlobexFibs and showglobexFib2 and Today and RTH then globexFib5 else NAN;
globexFib5Line.setDefaultColor(GlobalColor("fibColor2"));
globexFib5Line.hideBubble();
def globexFib6 = Round(ONLow +  ((ONHigh - ONLow) * globexFibAmt2),RoundLevel);
plot globexFib6Line = if GlobexFibs and showglobexFib2 and Today and RTH then globexFib6 else NAN;
globexFib6Line.setDefaultColor(GlobalColor("fibColor2"));
globexFib6Line.hideBubble();

plot ONL;
ONL.SetDefaultColor(Color.WHITE);
ONL.HideBubble();
plot ONH;
ONH.SetDefaultColor(Color.WHITE);
ONH.HideBubble();

switch (displayType)

{
    case "At Timed Start":

        ONL = if secondsFromTime(Start_Time) >= 0 and Today then ONLow else nan;
        ONH = if secondsFromTime(Start_Time) >= 0 and Today then ONHigh else nan;
     
    case "From RTH Start":
        ONL = if today and RTH then ONLow else nan;
        ONH = if today and RTH then ONHigh else nan;

    case "Always":
        ONL = if today then ONLow else nan;
        ONH = if today then ONHigh else nan;
}
 

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

Very interesting...will be fun to see how it plays out over time. Any chance the view can be tweaked to see more than 1 day, like maybe the past 5 days? Also, any tricks or clues how you trade the chart levels? Thank you.
 
Very interesting...will be fun to see how it plays out over time. Any chance the view can be tweaked to see more than 1 day, like maybe the past 5 days? Also, any tricks or clues how you trade the chart levels? Thank you.
I just did a new study Opening Range with VWAP that does something similar to this one but allows you to look at all past sessions.
 
Here is volume version... https://tos.mx/y8ECOOT
Ruby:
# GlobeX or Overnight High / Low with Fibonacci Values?
# Mobius?
# V01.2012?

input PlotOverNightExtremes = yes;
input coeff_1 = .236;
input coeff_2 = .327;

# gmh: added the rest of the Fibs?
input coeff_3 = .500;
input coeff_4 = .618;
input coeff_5 = .789;
input coeff_6 = .882;

 
def o = open;
def h = high;
def l = low;
def c = close;
def v = volume;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if GlobeX and !Globex[1]
          then v
          else if GlobeX
               then vol[1] + v
               else Double.NaN;

def GlobeX_Volume = vol;
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.SetHiding(!PlotOverNightExtremes);
     ONH.SetPaintingStrategy(PaintingStrategy.SQUARES);
     ONH.SetDefaultColor(Color.BLUE);
     ONH.HideBubble();
     ONH.HideTitle();

plot ONL = if OverNightLow > 0
           then OverNightLow
           else Double.NaN;
     ONL.SetHiding(!PlotOverNightExtremes);
     ONL.SetPaintingStrategy(PaintingStrategy.SQUARES);
     ONL.SetDefaultColor(Color.LIGHT_GRAY);
     ONL.HideBubble();
     ONL.HideTitle();

def MaxBar = Max(HighestAll(ONhighBar), HighestAll(ONlowBar));

plot coeff1 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then ((OverNightHigh - OverNightLow) * coeff_1) + OverNightLow
              else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_1)
              else double.nan;

plot coeff2 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then ((OverNightHigh - OverNightLow) * coeff_2) + OverNightLow
               else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_2)
              else double.nan;

plot coeff3 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then ((OverNightHigh - OverNightLow) * coeff_3) + OverNightLow
              else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_3)
              else double.nan;

plot coeff4 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then ((OverNightHigh - OverNightLow) * coeff_4) + OverNightLow
              else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_4)
              else double.nan;
plot coeff5 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then ((OverNightHigh - OverNightLow) * coeff_5) + OverNightLow
              else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_5)
              else double.nan;

plot coeff6 = if HighestAll(ONhighBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then ((OverNightHigh - OverNightLow) * coeff_6) + OverNightLow
              else if HighestAll(ONlowBar) == MaxBar and OverNightLow > 0 and OverNightHigh > 0
              then OverNightHigh - ((OverNightHigh - OverNightLow) * coeff_6)
              else double.nan;
#?
# End Code GlobeX High Low with Fibs?
 
Last edited by a moderator:
@FutureTony What time frame this globex level can be used? I tried on 1min chart and it shows only bubble Globex High and Low without any lines. Same behavior on all other time frames too. Appreciate if you can provide some details.
 
@FutureTony What time frame this globex level can be used? I tried on 1min chart and it shows only bubble Globex High and Low without any lines. Same behavior on all other time frames too. Appreciate if you can provide some details.
The study was intended to be used at RTH start. Most of the lines start printing at 9:30am. There is another study from Mobius that plots the current globex highs and lows vs the RTH highs and lows that might be better for you, depending what you are after. At the very least, if you change the first option from 'From RTH Start' to 'Always', you will see the lines as they develop. Hope that helps!
 
Hello friends,

I am back today with a bit of a different take on overnight trading levels. This study is intended for daytrading futures and tracks the highs/lows of the globex session and auto-plots fibs (and extensions) based on those levels.

h4MRCaC.png


There is another study that is a bit more precise in the plotting of the highs and lows from the exact high and low candle but it recursively scans the entire chart, making it taxing on your system. This one is a bit lighter weight and has 3 options for when the levels print - at RTH open, at a timed start or always. I find the 'always' setting gets a bit messy and prefer to usually start at RTH. The fib levels are customizable and default to .618 and .236.
As with most indicators, context is king. Where are we opening - near the globex highs, right in the middle? These are clues to where price might go next. Add this to your chart and watch typical behaviour. The number of times we revisit the highs and lows each day might surprise you.
Ruby:
# Overnight trading range with Fibs
# Created by @tony_futures
#
input displayType = { "At timed start", default  "From RTH Start", "Always"};
input Start_Time = 0800;
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def RTH = GetTime() >= RegularTradingStart(GetYYYYMMDD());
def Today = if GetLastDay() == GetDay() then 1 else 0;

def ONhigh = if GlobeX and !Globex[1] then high else if Globex and high > ONhigh[1] then high else ONhigh[1];
def ONlow = if GlobeX and !GlobeX[1] then low else if GlobeX and low < ONlow[1] then low else ONlow[1];

def showBubbleNow = !IsNaN(close) and IsNaN(close[-1]);
input showBubbles = yes;
AddChartBubble(showBubbles and showBubbleNow[1], ONHigh[1], "Globex High", Color.GRAY, yes);
AddChartBubble(showBubbles and showBubbleNow[1], ONLow[1], "Globex Low", Color.GRAY, no);

# setup Colors
DefineGlobalColor("openColor", CreateColor(169, 169, 169));
DefineGlobalColor("midColor", CreateColor(94, 110, 59));
DefineGlobalColor("fibColor", CreateColor(28, 96, 109));
DefineGlobalColor("fibColor2", CreateColor(109, 84, 44));

input GlobexFibs = yes;
def NAN = Double.NaN;
input RoundLevel = 0;
input globexFibAmt = 0.618;
input showglobexFib1 = yes;
input showglobexMid = yes;
input showglobexFib1Extensions = no;
def globexFib1 = Round(ONLow + ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
def globexFib2 = Round(ONHigh - ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
plot globexFib1Line = if GlobexFibs and showglobexFib1 and Today and RTH then globexFib1 else NAN;
globexFib1Line.setDefaultColor(GlobalColor("fibColor"));
globexFib1Line.hideBubble();

plot globexFib2Line = if GlobexFibs and showglobexFib1 and Today and RTH then globexFib2 else NAN;
globexFib2Line.setDefaultColor(GlobalColor("fibColor"));
globexFib2Line.hideBubble();
def globexMid = Round(ONHigh - ((ONHigh - ONLow) /2),RoundLevel);
plot globexMidLine = if GlobexFibs and showglobexMid and Today and RTH then globexMid else NAN;
globexMidLine.setDefaultColor(GlobalColor("midColor"));
globexMidLine.hideBubble();
def globexFib3 = Round(ONHigh + ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
plot globexFib3Line = if GlobexFibs and showglobexFib1Extensions and Today and RTH then globexFib3 else NAN;
globexFib3Line.setDefaultColor(GlobalColor("fibColor"));
globexFib3Line.hideBubble();
def globexFib4 = Round(ONLow - ((ONHigh - ONLow) * globexFibAmt),RoundLevel);
plot globexFib4Line = if GlobexFibs and showglobexFib1Extensions and Today and RTH then globexFib4 else NAN;
globexFib4Line.setDefaultColor(GlobalColor("fibColor"));
globexFib4Line.hideBubble();

input globexFibAmt2 = 0.236;
input showglobexFib2 = yes;
def globexFib5 = Round(ONHigh - ((ONHigh - ONLow) * globexFibAmt2),RoundLevel);
plot globexFib5Line = if GlobexFibs and showglobexFib2 and Today and RTH then globexFib5 else NAN;
globexFib5Line.setDefaultColor(GlobalColor("fibColor2"));
globexFib5Line.hideBubble();
def globexFib6 = Round(ONLow +  ((ONHigh - ONLow) * globexFibAmt2),RoundLevel);
plot globexFib6Line = if GlobexFibs and showglobexFib2 and Today and RTH then globexFib6 else NAN;
globexFib6Line.setDefaultColor(GlobalColor("fibColor2"));
globexFib6Line.hideBubble();

plot ONL;
ONL.SetDefaultColor(Color.WHITE);
ONL.HideBubble();
plot ONH;
ONH.SetDefaultColor(Color.WHITE);
ONH.HideBubble();

switch (displayType)

{
    case "At Timed Start":

        ONL = if secondsFromTime(Start_Time) >= 0 and Today then ONLow else nan;
        ONH = if secondsFromTime(Start_Time) >= 0 and Today then ONHigh else nan;
    
    case "From RTH Start":
        ONL = if today and RTH then ONLow else nan;
        ONH = if today and RTH then ONHigh else nan;

    case "Always":
        ONL = if today then ONLow else nan;
        ONH = if today then ONHigh else nan;
}
Can you provide the Range_Volume_Indy code shown in your chart?
 
My green & red bars overlap each other. I'm trying to get them side by side just like on your chart. What settings do I need to change?
I believe that screenshot might be on a range chart. To be honest, I have not used that indy in quite some time. Maybe post a screenshot and your question in the other thread and that author can help you if there are any issues.
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
304 Online
Create Post

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