AgentDoubleOhh
New member
Hi all!
I can't figure out the math on how to add Fibonacci's to this code. The red lines are R's, the light blue line is the PP, the green lines are the S's, the grey lines are the 50% fib or midpoint and the orange lines I drew with the fib tool in-between the PP and R1 and S1 and so on. How would I go about coding the Fibonacci's in-between the pivots. Please help, thank you!
P.S. @BenTen do you have something like this?
I can't figure out the math on how to add Fibonacci's to this code. The red lines are R's, the light blue line is the PP, the green lines are the S's, the grey lines are the 50% fib or midpoint and the orange lines I drew with the fib tool in-between the PP and R1 and S1 and so on. How would I go about coding the Fibonacci's in-between the pivots. Please help, thank you!
P.S. @BenTen do you have something like this?
Code:
# PivotPoints
# Revision 02/24/17
# Eric Purdy
# http://tos.mx/G18lxp
declare once_per_bar;
input showOnlyToday = No;
input timeFrame = {default "DAY", "WEEK", "MONTH"};
defineGlobalColor("Mid Color", color.gray);
plot R3 = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).R3;
plot R2 = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).R2;
plot R1 = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).R1;
plot PP = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).PP;
plot S1 = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).S1;
plot S2 = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).S2;
plot S3 = PivotPoints(showOnlyToday = showOnlyToday, timeFrame = timeFrame).S3;
plot S4 = S3 - R2 + PP;
plot R4 = R3 + R2 - PP;
R4.setDefaultColor(color.red);
R3.setDefaultColor(color.red);
R2.setDefaultColor(color.red);
R1.setDefaultColor(color.red);
PP.setDefaultColor(color.cyan);
S1.setDefaultColor(color.green);
S2.setDefaultColor(color.green);
S3.setDefaultColor(color.green);
S4.setDefaultColor(color.green);
R4.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R3.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R2.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R1.setPaintingStrategy(paintingStrategy.HORIZONTAL);
PP.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S1.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S2.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S3.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S3.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S4.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R4.setLineWeight(2);
R3.setLineWeight(2);
R2.setLineWeight(2);
R1.setLineWeight(2);
PP.setLineWeight(2);
S1.setLineWeight(2);
S2.setLineWeight(2);
S3.setLineWeight(2);
S4.setLineWeight(2);
plot PR1M = PP + (R1-PP)/2;
plot R1R2M = R1 + (R2-R1)/2;
plot R2R3M = R2 + (R3-R2)/2;
plot PS1M = PP - (PP-S1)/2;
plot S1S2M = S1 - (S1-S2)/2;
plot S2S3M = S2 - (S2-S3)/2;
plot R3R4M = R3 + (R4 - R3)/2;
plot S3S4M = S3 - (S3 - S4)/2;
PR1M.assignValueColor(GlobalColor("Mid Color"));
R1R2M.assignValueColor(GlobalColor("Mid Color"));
R2R3M.assignValueColor(GlobalColor("Mid Color"));
R3R4M.assignValueColor(GlobalColor("Mid Color"));
PS1M.assignValueColor(GlobalColor("Mid Color"));
S1S2M.assignValueColor(GlobalColor("Mid Color"));
S2S3M.assignValueColor(GlobalColor("Mid Color"));
S3S4M.assignValueColor(GlobalColor("Mid Color"));
PR1M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R1R2M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R2R3M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
R3R4M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
PS1M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S1S2M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S2S3M.setPaintingStrategy(paintingStrategy.HORIZONTAL);
S3S4M.setPaintingStrategy(paintingStrategy.HORIZONTAL);