overnight high and lows with Fibonacci extensions levels for multiple days

safeline

New member
looking for an indicator to display overnight/globex highs and lows with fibonacci extensions for more then just 1 day.
 
Solution
looking for an indicator to display overnight/globex highs and lows with fibonacci extensions for more then just 1 day.
# 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])...
looking for an indicator to display overnight/globex highs and lows with fibonacci extensions for more then just 1 day.
# 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;
}
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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