Fibonacci Pivot Points for ThinkOrSwim

ArrOne

New member
2019 Donor
Is there any indicator out there that plots pivots using fibs?

Fibonacci Pivot Point = (High + Low + Close) / 3
S1 = Fibonacci Pivot – 0.382 * (High – Low)
S2 = Fibonacci Pivot – 0.618 * (High – Low)
S3 = Fibonacci Pivot – 1.000 * (High – Low)
R1 = Fibonacci Pivot + 0.382 * (High – Low)
R2 = Fibonacci Pivot + 0.618 * (High – Low)
R3 = Fibonacci Pivot + 1.000 * (High – Low)
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Have you tried searching for it on here? I think we posted a few Fibs and Pivots related indicators.
 

korygill

Well-known member
VIP
This study is the thinkorswim version of the same study for Interactive Brokers.

The description of the study is found here:
https://www.interactivebrokers.com/...k/technicalanalytics/fibonaccipivotpoints.htm

This is what it looks like on the IB chart

kdiXRmN.png


This is what it looks like on the thinkorswim chart

8W9vbex.png


The code is the fibs based on prev day close (could change to weekly, monthly if desired with some modification).

Pivot point studies highlight prices considered to be a likely turning point when looking at values from a previous period, whether it be daily, weekly, quarterly or annual. Each pivot point study has its own characteristics on how these points are calculated. The formula applied for the Fibonacci Pivot Points is:

Pivot Point (P) = (High + Low + Close)/3
Support 1 (S1) = P - {.382 * (High - Low)}
Support 2 (S2) = P - {.618 * (High - Low)}
Support 3 (S3) = P - {1 * (High - Low)}
Resistance 1 (R1) = P + {.382 * (High - Low)}
Resistance 2 (R2) = P + {.618 * (High - Low)}
Resistance 3 (R3) = P + {1 * (High - Low)}

thinkScript code

Code:
# IB_Fib_Pivots
# Author: Kory Gill, @korygill
#
# VERSION HISTORY (sortable date and time (your local time is fine), and your initials
# 20190906-1900-KG    - Created.
# ...
# ...

declare hide_on_daily;
declare once_per_bar;

input AggregationPeriod = AggregationPeriod.DAY;

#
# logic
#
def nan = Double.NaN;
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def afterEnd = GetTime() > RegularTradingEnd(GetYYYYMMDD());
def firstBarOfDay = if (beforeStart[1] == 1 and beforeStart == 0) or (isRollover and beforeStart == 0) then 1 else 0;
def lastBarOfDay = if
    (afterEnd[-1] == 1 and afterEnd == 0) or
    (isRollover[-1] and firstBarOfDay[-1])
    then 1
    else 0;

#
# See this page for how to calculate the indicator
# https://www.interactivebrokers.com/en/software/tws/usersguidebook/technicalanalytics/fibonaccipivotpoints.htm
# Pivot Point (P) = (High + Low + Close)/3
# Support 1 (S1) = P - {.382 * (High - Low)}
# Support 2 (S2) = P - {.618 * (High - Low)}
# Support 3 (S3) = P - {1 * (High - Low)}
# Resistance 1 (R1) = P + {.382 * (High - Low)}
# Resistance 2 (R2) = P + {.618 * (High - Low)}
# Resistance 3 (R3) = P + {1 * (High - Low)}
#

def pc = close(period = AggregationPeriod)[1];
def ph = high(period = AggregationPeriod)[1];
def pl = low(period = AggregationPeriod)[1];

#Pivot Point (P) = (High + Low + Close)/3
#Support 1 (S1) = P - {.382 * (High - Low)}
#Support 2 (S2) = P - {.618 * (High - Low)}
#Support 3 (S3) = P - {1 * (High - Low)}
#Resistance 1 (R1) = P + {.382 * (High - Low)}
#Resistance 2 (R2) = P + {.618 * (High - Low)}
#Resistance 3 (R3) = P + {1 * (High - Low)}

def delta = ph - pl;
def pp = if firstBarOfDay then (pc+ph+pl)/3 else if lastBarOfDay then nan else pp[1];
def s1 = if firstBarOfDay then pp - (.382 * delta) else if lastBarOfDay then nan else s1[1];
def s2 = if firstBarOfDay then pp - (.618 * delta) else if lastBarOfDay then nan else s2[1];
def s3 = if firstBarOfDay then pp - (1 * delta) else if lastBarOfDay then nan else s3[1];
def r1 = if firstBarOfDay then pp + (.382 * delta) else if lastBarOfDay then nan else r1[1];
def r2 = if firstBarOfDay then pp + (.618 * delta) else if lastBarOfDay then nan else r2[1];
def r3 = if firstBarOfDay then pp + (1 * delta) else if lastBarOfDay then nan else r3[1];

plot ppp = pp;
plot ps1 = s1;
plot ps2 = s2;
plot ps3 = s3;
plot pr1 = r1;
plot pr2 = r2;
plot pr3 = r3;

ppp.SetDefaultColor(Color.Red);
ps1.SetDefaultColor(Color.Green);
ps2.SetDefaultColor(Color.White);
ps3.SetDefaultColor(Color.Magenta);
pr1.SetDefaultColor(Color.Yellow);
pr2.SetDefaultColor(Color.Violet);
pr3.SetDefaultColor(Color.Blue);

Link to the study

https://tos.mx/xPiy57
 

korygill

Well-known member
VIP
@RDMercer are you saying the two screenshots I included in the original post do not work for you, or you found some condition where the study does not work? Your post gives no insight into what does not work for you.
 

RDMercer

Member
@RDMercer are you saying the two screenshots I included in the original post do not work for you, or you found some condition where the study does not work? Your post gives no insight into what does not work for you.
The study seems not to function over all time frames other than intra day or short time frame integration. (1min, 5min, etc) It doesn't work for a 1 y 1d or Wk or larger time frame. Granted, this mat be as designed / intended, might not have every setting 100% correct, or perhaps I misunderstood the study functionality to start with.
 

korygill

Well-known member
VIP
Ahh...I put this in the original post

The code is the fibs based on prev day close (could change to weekly, monthly if desired with some modification).

It would take more work to have this work on all charts/time frames.
 

haha54

Member
Does anyone know how to run a scan using a program available here that would allow me to find stocks that crossed above the Fibonacci Pivot Point on the Daily Chart? I don't want Support lines 123 or Resistance lines 123 just the Fibonacci Pivot point.
Thanks
 

Antares66

Member
Hello, does anyone know where i can find the fibonacci pivot point indicator?
I found it for tradingview. The indicator shows on the chart the monthly fibonacci level and
three support and resistance levels as a line. I find the indicator very useful.
Thanks
 

Antares66

Member
It doesn´t calculate the pivot levels for the month correctly, instead it´s calculating only for the last day.
I would like to get the monthly pivot levels and plotted them on the daily.
 

SleepyZ

Well-known member
VIP
Lifetime
Hello, does anyone know where i can find the fibonacci pivot point indicator?
I found it for tradingview. The indicator shows on the chart the monthly fibonacci level and
three support and resistance levels as a line. I find the indicator very useful.
Thanks
This should help you get started.
Capture.jpg
Ruby:
#Fibonacci Pivot Points

input timeFrame     = AggregationPeriod.DAY;
input displace      = 0;#hint displace: 0=Today; 1=Yesterday; .... etc;
input lines         = {default dashes, points, triangles, horizontal, squares};
input showOnlyToday = no;

input showBubble    = yes;
input ShiftBubble   = 5;
def   n1            = ShiftBubble + 1;

def range           = (high(period = timeFrame)[displace] - low(period = timeFrame)[displace]) ;

plot R4;
plot R3;
plot R2;
plot R1;
plot PP;
plot S1;
plot S2;
plot S3;
plot S4;

if showOnlyToday and !IsNaN(close(period = timeFrame)[-1])
then {
    R1 = Double.NaN;
    R2 = Double.NaN;
    R3 = Double.NaN;
    R4 = Double.NaN;
    PP = Double.NaN;
    S1 = Double.NaN;
    S2 = Double.NaN;
    S3 = Double.NaN;
    S4 = Double.NaN;

} else {

    PP = (high(period = timeFrame)[displace] + low(period = timeFrame)[displace] + close(period = timeFrame)[displace]) / 3;
    R1 = PP + (range * .382);
    R2 = PP + (range * .618);
    R3 = PP + (range * 1.0);
    R4 = PP + (range * 1.618);
    S1 = PP - (range * .382);
    S2 = PP - (range * .618);
    S3 = PP - (range * 1.0);
    S4 = PP - (range * 1.618);

}

PP.SetDefaultColor(Color.WHITE);
R1.SetDefaultColor(Color.RED);
R2.SetDefaultColor(Color.RED);
R3.SetDefaultColor(Color.RED);
R4.SetDefaultColor(Color.RED);
S1.SetDefaultColor(Color.GREEN);
S2.SetDefaultColor(Color.GREEN);
S3.SetDefaultColor(Color.GREEN);
S4.SetDefaultColor(Color.GREEN);

def paintingStrategy = if lines == lines.points then PaintingStrategy.POINTS
                       else if lines == lines.triangles then PaintingStrategy.TRIANGLES
                       else if lines == lines.dashes then PaintingStrategy.DASHES
                       else if lines == lines.horizontal then PaintingStrategy.HORIZONTAL
                       else PaintingStrategy.SQUARES;

PP.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);
S4.SetPaintingStrategy(paintingStrategy);

def cond = showBubble and IsNaN(close[ShiftBubble]) and !IsNaN(close[n1]) ;
input show_bubble_price = yes;
AddChartBubble(cond, R1, "R1\n" + (if !show_bubble_price then Double.NaN else Round(R1)), Color.MAGENTA);
AddChartBubble(cond, R2, "R2\n" + (if !show_bubble_price then Double.NaN else Round(R2)), Color.MAGENTA);
AddChartBubble(cond, R3, "R3\n" + (if !show_bubble_price then Double.NaN else Round(R3)), Color.MAGENTA);
AddChartBubble(cond, R4, "R4\n" + (if !show_bubble_price then Double.NaN else Round(R4)), Color.MAGENTA);
AddChartBubble(cond, PP, "PP\n" + (if !show_bubble_price then Double.NaN else Round(PP)), Color.MAGENTA);
AddChartBubble(cond, S1, "S1\n" + (if !show_bubble_price then Double.NaN else Round(S1)), Color.MAGENTA);
AddChartBubble(cond, S2, "S2\n" + (if !show_bubble_price then Double.NaN else Round(S2)), Color.MAGENTA);
AddChartBubble(cond, S3, "S3\n" + (if !show_bubble_price then Double.NaN else Round(S3)), Color.MAGENTA);
AddChartBubble(cond, S4, "S4\n" + (if !show_bubble_price then Double.NaN else Round(S4)), Color.MAGENTA);

PP.HideBubble();
R1.HideBubble();
R2.HideBubble();
R3.HideBubble();
R4.HideBubble();
S1.HideBubble();
S2.HideBubble();
S3.HideBubble();
S4.HideBubble();
#####
 

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.
Top