```
#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();
#####
```