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

Code:
##### Version 6
##### 12/07/2014
##### 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]) ;

Mid1.SetHiding (!MidPlot);
Mid2.SetHiding (!MidPlot);
Mid3.SetHiding (!MidPlot);
Mid_1.SetHiding (!MidPlot);
Mid_2.SetHiding (!MidPlot);
Mid_3.SetHiding (!MidPlot);

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?