Fibonacci Pivots with mid-pivots and Time Frame selection

horserider

Well-known member
VIP
Another Fib pivots study with mid pivot point and option to choose time period for pivots. Has the option of displaying labels. If use labels might want to have an expansion area of 25 or so. Can choose to display today only or also previous periods. Lots of these so choose the one you like best.

f6de0A2.png


Code:
##### Made By Leonard
##### Version 6
##### 12/07/2014
##### Copyright Leonard Tulko 2014 - 2015 All rights reserved
##### This software is licensed for individual use only.
 
 
 
input marketThreshold = 0.00;
input timeFrame = AggregationPeriod.DAY;
input MidPlot = yes;
input showOnlyToday = no;
input showBubble = yes;
input ShiftBubble = 5;
def n1 = ShiftBubble + 1;
 
 
def PP2 = high(period = timeFrame)[2] + low(period = timeFrame)[2] + close(period = timeFrame)[2];
 
plot R4;
plot R3;
plot Mid3;
plot R2;
plot Mid2;
plot R1;
plot Mid1;
plot PP;
plot Mid_1;
plot S1;
plot Mid_2;
plot S2;
plot Mid_3;
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;
    Mid1 = Double.NaN;
    Mid2 = Double.NaN;
    Mid3 = Double.NaN;
    Mid_1 = Double.NaN;
    Mid_2 = Double.NaN;
    Mid_3 = Double.NaN;
 
} else {
 
    PP = (high(period = timeFrame)[1] + low(period = timeFrame)[1] + close(period = timeFrame)[1]) / 3;
 
    Mid1 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .236);
    Mid2 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .50);
    Mid3 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .786);
 
    Mid_1 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .236);
    Mid_2 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .50);
    Mid_3 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .786);
 
    R1 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .382);
    R2 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .618);
    R3 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * 1.0);
    R4 = PP + ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * 1.618);
 
    S1 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .382);
    S2 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * .618);
    S3 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * 1.0);
    S4 = PP - ((high(period = timeFrame)[1] - low(period = timeFrame)[1]) * 1.618);
 
 
}
 
PP.SetDefaultColor(GetColor(0));
R1.SetDefaultColor(Color.Red);
R2.SetDefaultColor(Color.Red);
R3.SetDefaultColor(Color.Red);
R4.SetDefaultColor(Color.Red);
S1.SetDefaultColor(Color.Yellow);
S2.SetDefaultColor(Color.Yellow);
S3.SetDefaultColor(Color.Yellow);
S4.SetDefaultColor(Color.Yellow);
Mid1.SetDefaultColor(GetColor(3));
Mid2.SetDefaultColor(GetColor(3));
Mid3.SetDefaultColor(GetColor(3));
Mid_1.SetDefaultColor(GetColor(3));
Mid_2.SetDefaultColor(GetColor(3));
Mid_3.SetDefaultColor(GetColor(3));
 
PP.SetStyle(Curve.SHORT_DASH);
R1.SetStyle(Curve.SHORT_DASH);
R2.SetStyle(Curve.SHORT_DASH);
R3.SetStyle(Curve.SHORT_DASH);
R4.SetStyle(Curve.SHORT_DASH);
S1.SetStyle(Curve.SHORT_DASH);
S2.SetStyle(Curve.SHORT_DASH);
S3.SetStyle(Curve.SHORT_DASH);
S4.SetStyle(Curve.SHORT_DASH);
Mid1.SetStyle(Curve.SHORT_DASH);
Mid2.SetStyle(Curve.SHORT_DASH);
Mid3.SetStyle(Curve.SHORT_DASH);
Mid_1.SetStyle(Curve.SHORT_DASH);
Mid_2.SetStyle(Curve.SHORT_DASH);
Mid_3.SetStyle(Curve.SHORT_DASH);
 
def paintingStrategy = if timeFrame == AggregationPeriod.WEEK then PaintingStrategy.DASHES else if timeFrame == AggregationPeriod.MONTH then PaintingStrategy.DASHES else PaintingStrategy.LINE_VS_POINTS;
 
PP.SetPaintingStrategy(PaintingStrategy.DASHES);
R1.SetPaintingStrategy(PaintingStrategy.DASHES);
R2.SetPaintingStrategy(PaintingStrategy.DASHES);
R3.SetPaintingStrategy(PaintingStrategy.DASHES);
R4.SetPaintingStrategy(PaintingStrategy.DASHES); 
S1.SetPaintingStrategy(PaintingStrategy.DASHES);
S2.SetPaintingStrategy(PaintingStrategy.DASHES);
S3.SetPaintingStrategy(PaintingStrategy.DASHES);
S4.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid3.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_1.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_2.SetPaintingStrategy(PaintingStrategy.DASHES);
Mid_3.SetPaintingStrategy(PaintingStrategy.DASHES);
 
def cond = showBubble and isNaN(close[ShiftBubble]) and !isNaN(close[n1]) ;
AddChartBubble(cond,PP,Concat("PP: ",Round(PP)),color.magenta);
AddChartBubble(cond,R1,Concat("R1: ",Round(R1)),color.magenta);
AddChartBubble(cond,R2,Concat("R2: ",Round(R2)),color.magenta);
AddChartBubble(cond,R3,Concat("R3: ",Round(R3)),color.magenta);
AddChartBubble(cond,R4,Concat("R4: ",Round(R4)),color.magenta);
AddChartBubble(cond,S1,Concat("S1: ",Round(S1)),color.magenta);
AddChartBubble(cond,S2,Concat("S2: ",Round(S2)),color.magenta);
AddChartBubble(cond,S3,Concat("S3: ",Round(S3)),color.magenta);
AddChartBubble(cond,S4,Concat("S4: ",Round(S4)),color.magenta);
AddChartBubble(cond,Mid1,Concat("Mid1: ",Round(Mid1)),color.magenta);
AddChartBubble(cond,Mid2,Concat("Mid2: ",Round(Mid2)),color.magenta);
AddChartBubble(cond,Mid3,Concat("Mid3: ",Round(Mid3)),color.magenta);
AddChartBubble(cond,Mid_1,Concat("Mid_1: ",Round(Mid_1)),color.magenta);
AddChartBubble(cond,Mid_2,Concat("Mid_2: ",Round(Mid_2)),color.magenta);
AddChartBubble(cond,Mid_3,Concat("Mid_3: ",Round(Mid_3)),color.magenta);
 
Mid1.SetHiding (!MidPlot);
Mid2.SetHiding (!MidPlot);
Mid3.SetHiding (!MidPlot);
Mid_1.SetHiding (!MidPlot);
Mid_2.SetHiding (!MidPlot);
Mid_3.SetHiding (!MidPlot);
 

Attachments

  • f6de0A2.png
    f6de0A2.png
    98.1 KB · Views: 152

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