Daily Fibonaccis: globex market profile For ThinkOrSwim

chiropteraphile

New member
Plots an excessive amount of fibonacci levels for volatile and trending markets, based on prior day RTH high (green), low (red), and halfback (dark orange), for futures. You can remove extra fibs depending on how many you want to load.

Chart timeframe should be XD:XM or similar (not Today:XM).

p8EJiud.png



#
def na = Double.NaN;
def bn = BarNumber();
def h = high;
def l = low;

script prior {
input prior = close;
def priorOf = if prior != prior[1] then prior[1] else priorOf[1];
plot priorBar = priorOf;
}

def cb = HighestAll(if !IsNaN(h) then bn else na);
def time = GetTime();
def rts = RegularTradingStart(GetYYYYMMDD());
def rte = RegularTradingEnd(GetYYYYMMDD());
def RTH = if time crosses above rts
then bn else RTH[1];
def globex = if time crosses below rte
then bn else globex[1];

def priorRTH = prior(RTH);
def priorGlobex = prior(globex);
def hRTH = HighestAll(RTH);
def hGX = HighestAll(globex);
def hPRTH = HighestAll(priorRTH);
def hPGX = HighestAll(priorGlobex);

def gXhigh = HighestAll(if bn >= hGX && bn < hRTH
then h else if hRTH < hGX && bn >= hGX
then h else na);
def gXlow = LowestAll(if bn >= hGX && bn < hRTH
then l else if hRTH < hGX && bn >= hGX
then l else na);
def RTHhigh = HighestAll(if bn >= hRTH && bn < hGX
then h else if hGX < hRTH && bn >= hRTH
then h else na);
def RTHlow = LowestAll(if bn >= hRTH && bn < hGX
then l else if hGX < hRTH && bn >= hRTH
then l else na);

def priorRTHhigh = HighestAll(if bn >= hPRTH
&& bn < if hGX < hRTH then hGX
else hPGX then h else na);
def priorRTHlow = LowestAll(if bn >= hPRTH
&& bn < if hGX < hRTH then hGX
else hPGX then l else na);

def rTHrange = priorRTHhigh - priorRTHlow;
def sumHighLow = priorRTHhigh + priorRTHLow;

plot Fib5000 = priorRTHLow + (rTHrange * 5.000);
Fib5000.SetDefaultColor(Color.Gray);
Fib5000.SetPaintingStrategy(PaintingStrategy.Line);
Fib5000.SetStyle(Curve.FIRM);
Fib5000.SetLineWeight(2);
Fib5000.HideBubble();
Fib5000.HideTitle();

plot Fib4809 = priorRTHLow + (rTHrange * 4.809);
Fib4809.SetDefaultColor(Color.Gray);
Fib4809.SetPaintingStrategy(PaintingStrategy.Line);
Fib4809.SetStyle(Curve.Long_Dash);
Fib4809.SetLineWeight(1);
Fib4809.HideBubble();
Fib4809.HideTitle();

plot Fib4618 = priorRTHLow + (rTHrange * 4.618);
Fib4618.SetDefaultColor(Color.Gray);
Fib4618.SetPaintingStrategy(PaintingStrategy.Line);
Fib4618.SetStyle(Curve.Firm);
Fib4618.SetLineWeight(1);
Fib4618.HideBubble();
Fib4618.HideTitle();

plot Fib4500 = priorRTHLow + (rTHrange * 4.500);
Fib4500.SetDefaultColor(Color.Gray);
Fib4500.SetPaintingStrategy(PaintingStrategy.Line);
Fib4500.SetStyle(Curve.Firm);
Fib4500.SetLineWeight(2);
Fib4500.HideBubble();
Fib4500.HideTitle();

plot Fib4382 = priorRTHLow + (rTHrange * 4.382);
Fib4382.SetDefaultColor(Color.Gray);
Fib4382.SetPaintingStrategy(PaintingStrategy.Line);
Fib4382.SetStyle(Curve.Firm);
Fib4382.SetLineWeight(1);
Fib4382.HideBubble();
Fib4382.HideTitle();

plot Fib4191 = priorRTHLow + (rTHrange * 4.191);
Fib4191.SetDefaultColor(Color.Gray);
Fib4191.SetPaintingStrategy(PaintingStrategy.Line);
Fib4191.SetStyle(Curve.Long_Dash);
Fib4191.SetLineWeight(1);
Fib4191.HideBubble();
Fib4191.HideTitle();

plot Fib4000 = priorRTHLow + (rTHrange * 4);
Fib4000.SetDefaultColor(Color.Gray);
Fib4000.SetPaintingStrategy(PaintingStrategy.Line);
Fib4000.SetStyle(Curve.FIRM);
Fib4000.SetLineWeight(2);
Fib4000.HideBubble();
Fib4000.HideTitle();

plot Fib3809 = priorRTHLow + (rTHrange * 3.809);
Fib3809.SetDefaultColor(Color.Gray);
Fib3809.SetPaintingStrategy(PaintingStrategy.Line);
Fib3809.SetStyle(Curve.Long_Dash);
Fib3809.SetLineWeight(1);
Fib3809.HideBubble();
Fib3809.HideTitle();

plot Fib3618 = priorRTHLow + (rTHrange * 3.618);
Fib3618.SetDefaultColor(Color.Gray);
Fib3618.SetPaintingStrategy(PaintingStrategy.Line);
Fib3618.SetStyle(Curve.Firm);
Fib3618.SetLineWeight(1);
Fib3618.HideBubble();
Fib3618.HideTitle();

plot Fib3500 = priorRTHLow + (rTHrange * 3.500);
Fib3500.SetDefaultColor(Color.Gray);
Fib3500.SetPaintingStrategy(PaintingStrategy.Line);
Fib3500.SetStyle(Curve.Firm);
Fib3500.SetLineWeight(2);
Fib3500.HideBubble();
Fib3500.HideTitle();

plot Fib3382 = priorRTHLow + (rTHrange * 3.382);
Fib3382.SetDefaultColor(Color.Gray);
Fib3382.SetPaintingStrategy(PaintingStrategy.Line);
Fib3382.SetStyle(Curve.Firm);
Fib3382.SetLineWeight(1);
Fib3382.HideBubble();
Fib3382.HideTitle();

plot Fib3191 = priorRTHLow + (rTHrange * 3.191);
Fib3191.SetDefaultColor(Color.Gray);
Fib3191.SetPaintingStrategy(PaintingStrategy.Line);
Fib3191.SetStyle(Curve.Long_Dash);
Fib3191.SetLineWeight(1);
Fib3191.HideBubble();
Fib3191.HideTitle();

plot Fib3000 = priorRTHLow + (rTHrange * 3.000);
Fib3000.SetDefaultColor(Color.Gray);
Fib3000.SetPaintingStrategy(PaintingStrategy.Line);
Fib3000.SetStyle(Curve.FIRM);
Fib3000.SetLineWeight(2);
Fib3000.HideBubble();
Fib3000.HideTitle();

plot Fib2809 = priorRTHLow + (rTHrange * 2.809);
Fib2809.SetDefaultColor(Color.Gray);
Fib2809.SetPaintingStrategy(PaintingStrategy.Line);
Fib2809.SetStyle(Curve.Long_Dash);
Fib2809.SetLineWeight(1);
Fib2809.HideBubble();
Fib2809.HideTitle();

plot Fib2618 = priorRTHLow + (rTHrange * 2.618);
Fib2618.SetDefaultColor(Color.Gray);
Fib2618.SetPaintingStrategy(PaintingStrategy.Line);
Fib2618.SetStyle(Curve.Firm);
Fib2618.SetLineWeight(1);
Fib2618.HideBubble();
Fib2618.HideTitle();

plot Fib2500 = priorRTHLow + (rTHrange * 2.500);
Fib2500.SetDefaultColor(Color.Gray);
Fib2500.SetPaintingStrategy(PaintingStrategy.Line);
Fib2500.SetStyle(Curve.Firm);
Fib2500.SetLineWeight(2);
Fib2500.HideBubble();
Fib2500.HideTitle();

plot Fib2382 = priorRTHLow + (rTHrange * 2.382);
Fib2382.SetDefaultColor(Color.Gray);
Fib2382.SetPaintingStrategy(PaintingStrategy.Line);
Fib2382.SetStyle(Curve.Firm);
Fib2382.SetLineWeight(1);
Fib2382.HideBubble();
Fib2382.HideTitle();

plot Fib2191 = priorRTHLow + (rTHrange * 2.191);
Fib2191.SetDefaultColor(Color.Gray);
Fib2191.SetPaintingStrategy(PaintingStrategy.Line);
Fib2191.SetStyle(Curve.Long_Dash);
Fib2191.SetLineWeight(1);
Fib2191.HideBubble();
Fib2191.HideTitle();

plot Fib2000 = priorRTHLow + (rTHrange * 2.000);
Fib2000.SetDefaultColor(Color.Gray);
Fib2000.SetPaintingStrategy(PaintingStrategy.Line);
Fib2000.SetStyle(Curve.FIRM);
Fib2000.SetLineWeight(2);
Fib2000.HideBubble();
Fib2000.HideTitle();

plot Fib1809 = priorRTHLow + (rTHrange * 1.809);
Fib1809.SetDefaultColor(Color.Gray);
Fib1809.SetPaintingStrategy(PaintingStrategy.Line);
Fib1809.SetStyle(Curve.Long_Dash);
Fib1809.SetLineWeight(1);
Fib1809.HideBubble();
Fib1809.HideTitle();

plot Fib1618 = priorRTHLow + (rTHrange * 1.618);
Fib1618.SetDefaultColor(Color.Gray);
Fib1618.SetPaintingStrategy(PaintingStrategy.Line);
Fib1618.SetStyle(Curve.Firm);
Fib1618.SetLineWeight(1);
Fib1618.HideBubble();
Fib1618.HideTitle();

plot Fib1500 = priorRTHLow + (rTHrange * 1.500);
Fib1500.SetDefaultColor(Color.Gray);
Fib1500.SetPaintingStrategy(PaintingStrategy.Line);
Fib1500.SetStyle(Curve.Firm);
Fib1500.SetLineWeight(2);
Fib1500.HideBubble();
Fib1500.HideTitle();

plot Fib1382 = priorRTHLow + (rTHrange * 1.382);
Fib1382.SetDefaultColor(Color.Gray);
Fib1382.SetPaintingStrategy(PaintingStrategy.Line);
Fib1382.SetStyle(Curve.Firm);
Fib1382.SetLineWeight(1);
Fib1382.HideBubble();
Fib1382.HideTitle();

plot Fib1191 = priorRTHLow + (rTHrange * 1.191);
Fib1191.SetDefaultColor(Color.Gray);
Fib1191.SetPaintingStrategy(PaintingStrategy.Line);
Fib1191.SetStyle(Curve.Long_Dash);
Fib1191.SetLineWeight(1);
Fib1191.HideBubble();
Fib1191.HideTitle();

plot PriorDayHigh = priorRTHhigh;
PriorDayHigh.SetDefaultColor(Color.Green);
PriorDayHigh.SetPaintingStrategy(PaintingStrategy.Line);
PriorDayHigh.SetStyle(Curve.FIRM);
PriorDayHigh.SetLineWeight(1);
PriorDayHigh.HideBubble();
PriorDayHigh.HideTitle();

plot Fib0809 = priorRTHLow + (rTHrange * 0.809);
Fib0809.SetDefaultColor(Color.Gray);
Fib0809.SetPaintingStrategy(PaintingStrategy.Line);
Fib0809.SetStyle(Curve.Long_Dash);
Fib0809.SetLineWeight(1);
Fib0809.HideBubble();
Fib0809.HideTitle();

plot Fib0618 = priorRTHLow + (rTHrange * 0.618);
Fib0618.SetDefaultColor(Color.Gray);
Fib0618.SetPaintingStrategy(PaintingStrategy.Line);
Fib0618.SetStyle(Curve.Firm);
Fib0618.SetLineWeight(1);
Fib0618.HideBubble();
Fib1618.HideTitle();

plot Halfback = sumHighLow / 2;
Halfback.SetDefaultColor(Color.Dark_Orange);
Halfback.SetPaintingStrategy(PaintingStrategy.Line);
Halfback.SetStyle(Curve.Firm);
Halfback.SetLineWeight(1);
Halfback.HideBubble();
Halfback.HideTitle();

plot Fib0382 = priorRTHLow + (rTHrange * 0.382);
Fib0382.SetDefaultColor(Color.Gray);
Fib0382.SetPaintingStrategy(PaintingStrategy.Line);
Fib0382.SetStyle(Curve.Firm);
Fib0382.SetLineWeight(1);
Fib0382.HideBubble();
Fib0382.HideTitle();

plot Fib0191 = priorRTHLow + (rTHrange * 0.191);
Fib0191.SetDefaultColor(Color.Gray);
Fib0191.SetPaintingStrategy(PaintingStrategy.Line);
Fib0191.SetStyle(Curve.Long_Dash);
Fib0191.SetLineWeight(1);
Fib0191.HideBubble();
Fib0191.HideTitle();

plot PriorDayLow = priorRTHlow;
PriorDayLow.SetDefaultColor(Color.Red);
PriorDayLow.SetPaintingStrategy(PaintingStrategy.Line);
PriorDayLow.SetStyle(Curve.FIRM);
PriorDayLow.SetLineWeight(1);
PriorDayLow.HideBubble();
PriorDayLow.HideTitle();

plot Fibn0191 = priorRTHLow + (rTHrange * -0.191);
Fibn0191.SetDefaultColor(Color.Gray);
Fibn0191.SetPaintingStrategy(PaintingStrategy.Line);
Fibn0191.SetStyle(Curve.Long_Dash);
Fibn0191.SetLineWeight(1);
Fibn0191.HideBubble();
Fibn0191.HideTitle();

plot Fibn0382 = priorRTHLow + (rTHrange * -0.382);
Fibn0382.SetDefaultColor(Color.Gray);
Fibn0382.SetPaintingStrategy(PaintingStrategy.Line);
Fibn0382.SetStyle(Curve.Firm);
Fibn0382.SetLineWeight(1);
Fibn0382.HideBubble();
Fibn0382.HideTitle();

plot Fibn0500 = priorRTHLow + (rTHrange * -0.500);
Fibn0500.SetDefaultColor(Color.Gray);
Fibn0500.SetPaintingStrategy(PaintingStrategy.Line);
Fibn0500.SetStyle(Curve.Firm);
Fibn0500.SetLineWeight(2);
Fibn0500.HideBubble();
Fibn0500.HideTitle();

plot Fibn0618 = priorRTHLow + (rTHrange * -0.618);
Fibn0618.SetDefaultColor(Color.Gray);
Fibn0618.SetPaintingStrategy(PaintingStrategy.Line);
Fibn0618.SetStyle(Curve.Firm);
Fibn0618.SetLineWeight(1);
Fibn0618.HideBubble();
Fibn0618.HideTitle();

plot Fibn0809 = priorRTHLow + (rTHrange * -0.809);
Fibn0809.SetDefaultColor(Color.Gray);
Fibn0809.SetPaintingStrategy(PaintingStrategy.Line);
Fibn0809.SetStyle(Curve.Long_Dash);
Fibn0809.SetLineWeight(1);
Fibn0809.HideBubble();
Fibn0809.HideTitle();

plot Fibn1000 = priorRTHLow + (rTHrange * -1.000);
Fibn1000.SetDefaultColor(Color.Gray);
Fibn1000.SetPaintingStrategy(PaintingStrategy.Line);
Fibn1000.SetStyle(Curve.FIRM);
Fibn1000.SetLineWeight(2);
Fibn1000.HideBubble();
Fibn1000.HideTitle();

plot Fibn1191 = priorRTHLow + (rTHrange * -1.191);
Fibn1191.SetDefaultColor(Color.Gray);
Fibn1191.SetPaintingStrategy(PaintingStrategy.Line);
Fibn1191.SetStyle(Curve.Long_Dash);
Fibn1191.SetLineWeight(1);
Fibn1191.HideBubble();
Fibn1191.HideTitle();

plot Fibn1382 = priorRTHLow + (rTHrange * -1.382);
Fibn1382.SetDefaultColor(Color.Gray);
Fibn1382.SetPaintingStrategy(PaintingStrategy.Line);
Fibn1382.SetStyle(Curve.Firm);
Fibn1382.SetLineWeight(1);
Fibn1382.HideBubble();
Fibn1382.HideTitle();

plot Fibn1500 = priorRTHLow + (rTHrange * -1.500);
Fibn1500.SetDefaultColor(Color.Gray);
Fibn1500.SetPaintingStrategy(PaintingStrategy.Line);
Fibn1500.SetStyle(Curve.Firm);
Fibn1500.SetLineWeight(2);
Fibn1500.HideBubble();
Fibn1500.HideTitle();

plot Fibn1618 = priorRTHLow + (rTHrange * -1.618);
Fibn1618.SetDefaultColor(Color.Gray);
Fibn1618.SetPaintingStrategy(PaintingStrategy.Line);
Fibn1618.SetStyle(Curve.Firm);
Fibn1618.SetLineWeight(1);
Fibn1618.HideBubble();
Fibn1618.HideTitle();

plot Fibn1809 = priorRTHLow + (rTHrange * -1.809);
Fibn1809.SetDefaultColor(Color.Gray);
Fibn1809.SetPaintingStrategy(PaintingStrategy.Line);
Fibn1809.SetStyle(Curve.Long_Dash);
Fibn1809.SetLineWeight(1);
Fibn1809.HideBubble();
Fibn1809.HideTitle();

plot Fibn2000 = priorRTHLow + (rTHrange * -2.000);
Fibn2000.SetDefaultColor(Color.Gray);
Fibn2000.SetPaintingStrategy(PaintingStrategy.Line);
Fibn2000.SetStyle(Curve.FIRM);
Fibn2000.SetLineWeight(2);
Fibn2000.HideBubble();
Fibn2000.HideTitle();

plot Fibn2191 = priorRTHLow + (rTHrange * -2.191);
Fibn2191.SetDefaultColor(Color.Gray);
Fibn2191.SetPaintingStrategy(PaintingStrategy.Line);
Fibn2191.SetStyle(Curve.Long_Dash);
Fibn2191.SetLineWeight(1);
Fibn2191.HideBubble();
Fibn2191.HideTitle();

plot Fibn2382 = priorRTHLow + (rTHrange * -2.382);
Fibn2382.SetDefaultColor(Color.Gray);
Fibn2382.SetPaintingStrategy(PaintingStrategy.Line);
Fibn2382.SetStyle(Curve.Firm);
Fibn2382.SetLineWeight(1);
Fibn2382.HideBubble();
Fibn2382.HideTitle();

plot Fibn2500 = priorRTHLow + (rTHrange * -2.500);
Fibn2500.SetDefaultColor(Color.Gray);
Fibn2500.SetPaintingStrategy(PaintingStrategy.Line);
Fibn2500.SetStyle(Curve.Firm);
Fibn2500.SetLineWeight(2);
Fibn2500.HideBubble();
Fibn2500.HideTitle();

plot Fibn2618 = priorRTHLow + (rTHrange * -2.618);
Fibn2618.SetDefaultColor(Color.Gray);
Fibn2618.SetPaintingStrategy(PaintingStrategy.Line);
Fibn2618.SetStyle(Curve.Firm);
Fibn2618.SetLineWeight(1);
Fibn2618.HideBubble();
Fibn2618.HideTitle();

plot Fibn2809 = priorRTHLow + (rTHrange * -2.809);
Fibn2809.SetDefaultColor(Color.Gray);
Fibn2809.SetPaintingStrategy(PaintingStrategy.Line);
Fibn2809.SetStyle(Curve.Long_Dash);
Fibn2809.SetLineWeight(1);
Fibn2809.HideBubble();
Fibn2809.HideTitle();

plot Fibn3000 = priorRTHLow + (rTHrange * -3.000);
Fibn3000.SetDefaultColor(Color.Gray);
Fibn3000.SetPaintingStrategy(PaintingStrategy.Line);
Fibn3000.SetStyle(Curve.FIRM);
Fibn3000.SetLineWeight(2);
Fibn3000.HideBubble();
Fibn3000.HideTitle();

plot Fibn3191 = priorRTHLow + (rTHrange * -3.191);
Fibn3191.SetDefaultColor(Color.Gray);
Fibn3191.SetPaintingStrategy(PaintingStrategy.Line);
Fibn3191.SetStyle(Curve.Long_Dash);
Fibn3191.SetLineWeight(1);
Fibn3191.HideBubble();
Fibn3191.HideTitle();

plot Fibn3382 = priorRTHLow + (rTHrange * -3.382);
Fibn3382.SetDefaultColor(Color.Gray);
Fibn3382.SetPaintingStrategy(PaintingStrategy.Line);
Fibn3382.SetStyle(Curve.Firm);
Fibn3382.SetLineWeight(1);
Fibn3382.HideBubble();
Fibn3382.HideTitle();

plot Fibn3500 = priorRTHLow + (rTHrange * -3.500);
Fibn3500.SetDefaultColor(Color.Gray);
Fibn3500.SetPaintingStrategy(PaintingStrategy.Line);
Fibn3500.SetStyle(Curve.Firm);
Fibn3500.SetLineWeight(2);
Fibn3500.HideBubble();
Fibn3500.HideTitle();

plot Fibn3618 = priorRTHLow + (rTHrange * -3.618);
Fibn3618.SetDefaultColor(Color.Gray);
Fibn3618.SetPaintingStrategy(PaintingStrategy.Line);
Fibn3618.SetStyle(Curve.Firm);
Fibn3618.SetLineWeight(1);
Fibn3618.HideBubble();
Fibn3618.HideTitle();

plot Fibn3809 = priorRTHLow + (rTHrange * -3.809);
Fibn3809.SetDefaultColor(Color.Gray);
Fibn3809.SetPaintingStrategy(PaintingStrategy.Line);
Fibn3809.SetStyle(Curve.Long_Dash);
Fibn3809.SetLineWeight(1);
Fibn3809.HideBubble();
Fibn3809.HideTitle();

plot Fibn4000 = priorRTHLow + (rTHrange * -4.000);
Fibn4000.SetDefaultColor(Color.Gray);
Fibn4000.SetPaintingStrategy(PaintingStrategy.Line);
Fibn4000.SetStyle(Curve.FIRM);
Fibn4000.SetLineWeight(2);
Fibn4000.HideBubble();
Fibn4000.HideTitle();
#
 

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
408 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