# Edit Time Script gets information from.

#### eulin87

##### Member
I have a FIB pivot script that I have been enjoying but I have been noticing that at times it will differ on ES and SPY. Obviously two different tickers but I usually chart on ES and trade SPY Options. I'm guessing the reason for offset is SPY obviously does not trade overnight like ES so I was wondering If someone can help me make my script start at 0300-1859. Thank you!

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;
input LabelsOn = yes;

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

#
# https://www.interactivebrokers.com/en/software/tws/usersguidebook/technicalanalytics/fibonaccipivotpoints.htm
# Pivot Point (P) = (High + Low + Close)/3
# Support 0 (S0) = P- {.236 * (High - Low)}
# Support 1 (S1) = P - {.382 * (High - Low)}
# Support 2 (S2) = P - {.5 * (High - Low)}
# Support 3 (S3) = P - {.618 * (High - Low)}
# Support 4 (S4) = P - {.764 * (High - Low)}
# Support 5 (S5) = P - {1 * (High - Low)}
# Resistance 0 (R0) = P + {.236 * (High - Low)}
# Resistance 1 (R1) = P + {.382 * (High - Low)}
# Resistance 2 (R2) = P + {.5 * (High - Low)}
# Resistance 3 (R3) = P + {.618 * (High - Low)}
# Resistance 4 (R4) = P + {.764 * (High - Low)}
# Resistance 5 (R5) = P + {1 * (High - Low)}
# Resistance 5 (R6) = P + {1.236 * (High - Low)}
# Resistance 5 (R7) = P + {1.618 * (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 0 (S0) = P - {.236 * (High - Low)}
#Support 1 (S1) = P - {.382 * (High - Low)}
#Support 2 (S2) = P - {.5 * (High - Low)}
#Support 3 (S3) = P - {.618 * (High - Low)}
#Support 3 (S4) = P - {.764 * (High - Low)}
#Support 4 (S5) = P - {1 * (High - Low)}
#Resistance 0 (R0) = P + {.236 * (High - Low)}
#Resistance 1 (R1) = P + {.382 * (High - Low)}
#Resistance 2 (R2) = P + {.5 * (High - Low)}
#Resistance 3 (R3) = P + {.618 * (High - Low)}
#Resistance 4 (R4) = P + {.764 * (High - Low)}
#Resistance 5 (R5) = P + {1 * (High - Low)}
#Resistance 6 (R6) = P + {1.272 * (High - Low)}
#Resistance 7 (R7) = P + {1.618 * (High - Low)}

def delta = ph - pl;
def pp = if firstBarOfDay then (pc + ph + pl) / 3 else if lastBarOfDay then nan else pp[1];
def s0 = if firstBarOfDay then pp - (.272 * delta) else if lastBarOfDay then nan else s0[1];
def s1 = if firstBarOfDay then pp - (.382 * delta) else if lastBarOfDay then nan else s1[1];
def s2 = if firstBarOfDay then pp - (.5 * delta) else if lastBarOfDay then nan else s2[1];
def s3 = if firstBarOfDay then pp - (.618 * delta) else if lastBarOfDay then nan else s3[1];
def s4 = if firstBarOfDay then pp - (.786 * delta) else if lastBarOfDay then nan else s4[1];
def s5 = if firstBarOfDay then pp - (1 * delta) else if lastBarOfDay then nan else s5[1];
def r0 = if firstBarOfDay then pp + (.236 * delta) else if lastBarOfDay then nan else r0[1];
def r1 = if firstBarOfDay then pp + (.382 * delta) else if lastBarOfDay then nan else r1[1];
def r2 = if firstBarOfDay then pp + (.5 * delta) else if lastBarOfDay then nan else r2[1];
def r3 = if firstBarOfDay then pp + (.618 * delta) else if lastBarOfDay then nan else r3[1];
def r4 = if firstBarOfDay then pp + (.786 * delta) else if lastBarOfDay then nan else r4[1];
def r5 = if firstBarOfDay then pp + (.886 * delta) else if lastBarOfDay then nan else r5[1];
def r6 = if firstBarOfDay then pp + (1 * delta) else if lastBarOfDay then nan else r6[1];
def r7 = if firstBarOfDay then pp + (1.236 * delta) else if lastBarOfDay then nan else r7[1];
def r8 = if firstBarOfDay then pp + (1.618 * delta) else if lastBarOfDay then nan else r8[1];

plot ppp = pp;
plot ps0 = s0;
plot ps1 = s1;
plot ps2 = s2;
plot ps3 = s3;
plot ps4 = s4;
plot ps5 = s5;
plot pr0 = r0;
plot pr1 = r1;
plot pr2 = r2;
plot pr3 = r3;
plot pr4 = r4;
plot pr5 = r5;
plot pr6 = r6;
plot pr7 = r7;
plot pr8 = r8;

ppp.SetDefaultColor(Color.WHITE);
ps0.SetDefaultColor(Color.GREEN);
ps1.SetDefaultColor(Color.GREEN);
ps2.SetDefaultColor(Color.GREEN);
ps3.SetDefaultColor(Color.GREEN);
ps4.SetDefaultColor(Color.GREEN);
ps5.SetDefaultColor(CREATEColor(231,133,0));
pr0.SetDefaultColor(Color.light_RED);
pr1.SetDefaultColor(Color.light_RED);
pr2.SetDefaultColor(Color.light_RED);
pr3.SetDefaultColor(Color.light_RED);
pr4.SetDefaultColor(Color.light_RED);
pr5.SetDefaultColor(Color.light_RED);
pr6.SetDefaultColor(CREATEColor(231,133,0));
pr7.SetDefaultColor(Color.green);
pr8.SetDefaultColor(Color.GREEN);

input ShowTodayOnly = yes;

#Bubbles
input bubblemover = 125;
def b  = bubblemover;
def b1 = b + 1;

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(PP[b1]) and !IsNaN(PP[b]), PP[b], "Pivot", GlobalColor("D"));

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R0[b1]) and !IsNaN(R0[b]), R0[b], "23.6%", GlobalColor("D"), Labelson);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R3[b1]) and !IsNaN(R3[b]), R3[b], "61.8%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R5[b1]) and !IsNaN(R5[b]), R5[b], "88.6%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R7[b1]) and !IsNaN(R7[b]), R7[b], "123.6%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R8[b1]) and !IsNaN(R8[b]), R8[b], "161.8%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S0[b1]) and !IsNaN(S0[b]), S0[b], "-27.2%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S1[b1]) and !IsNaN(S1[b]), S1[b], "-38.2%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S3[b1]) and !IsNaN(S3[b]), S3[b], "-61.8%", GlobalColor("D"), LabelsOn);``````

I have a FIB pivot script that I have been enjoying but I have been noticing that at times it will differ on ES and SPY. Obviously two different tickers but I usually chart on ES and trade SPY Options. I'm guessing the reason for offset is SPY obviously does not trade overnight like ES so I was wondering If someone can help me make my script start at 0300-1859. Thank you!

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;
input LabelsOn = yes;

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

#
# https://www.interactivebrokers.com/en/software/tws/usersguidebook/technicalanalytics/fibonaccipivotpoints.htm
# Pivot Point (P) = (High + Low + Close)/3
# Support 0 (S0) = P- {.236 * (High - Low)}
# Support 1 (S1) = P - {.382 * (High - Low)}
# Support 2 (S2) = P - {.5 * (High - Low)}
# Support 3 (S3) = P - {.618 * (High - Low)}
# Support 4 (S4) = P - {.764 * (High - Low)}
# Support 5 (S5) = P - {1 * (High - Low)}
# Resistance 0 (R0) = P + {.236 * (High - Low)}
# Resistance 1 (R1) = P + {.382 * (High - Low)}
# Resistance 2 (R2) = P + {.5 * (High - Low)}
# Resistance 3 (R3) = P + {.618 * (High - Low)}
# Resistance 4 (R4) = P + {.764 * (High - Low)}
# Resistance 5 (R5) = P + {1 * (High - Low)}
# Resistance 5 (R6) = P + {1.236 * (High - Low)}
# Resistance 5 (R7) = P + {1.618 * (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 0 (S0) = P - {.236 * (High - Low)}
#Support 1 (S1) = P - {.382 * (High - Low)}
#Support 2 (S2) = P - {.5 * (High - Low)}
#Support 3 (S3) = P - {.618 * (High - Low)}
#Support 3 (S4) = P - {.764 * (High - Low)}
#Support 4 (S5) = P - {1 * (High - Low)}
#Resistance 0 (R0) = P + {.236 * (High - Low)}
#Resistance 1 (R1) = P + {.382 * (High - Low)}
#Resistance 2 (R2) = P + {.5 * (High - Low)}
#Resistance 3 (R3) = P + {.618 * (High - Low)}
#Resistance 4 (R4) = P + {.764 * (High - Low)}
#Resistance 5 (R5) = P + {1 * (High - Low)}
#Resistance 6 (R6) = P + {1.272 * (High - Low)}
#Resistance 7 (R7) = P + {1.618 * (High - Low)}

def delta = ph - pl;
def pp = if firstBarOfDay then (pc + ph + pl) / 3 else if lastBarOfDay then nan else pp[1];
def s0 = if firstBarOfDay then pp - (.272 * delta) else if lastBarOfDay then nan else s0[1];
def s1 = if firstBarOfDay then pp - (.382 * delta) else if lastBarOfDay then nan else s1[1];
def s2 = if firstBarOfDay then pp - (.5 * delta) else if lastBarOfDay then nan else s2[1];
def s3 = if firstBarOfDay then pp - (.618 * delta) else if lastBarOfDay then nan else s3[1];
def s4 = if firstBarOfDay then pp - (.786 * delta) else if lastBarOfDay then nan else s4[1];
def s5 = if firstBarOfDay then pp - (1 * delta) else if lastBarOfDay then nan else s5[1];
def r0 = if firstBarOfDay then pp + (.236 * delta) else if lastBarOfDay then nan else r0[1];
def r1 = if firstBarOfDay then pp + (.382 * delta) else if lastBarOfDay then nan else r1[1];
def r2 = if firstBarOfDay then pp + (.5 * delta) else if lastBarOfDay then nan else r2[1];
def r3 = if firstBarOfDay then pp + (.618 * delta) else if lastBarOfDay then nan else r3[1];
def r4 = if firstBarOfDay then pp + (.786 * delta) else if lastBarOfDay then nan else r4[1];
def r5 = if firstBarOfDay then pp + (.886 * delta) else if lastBarOfDay then nan else r5[1];
def r6 = if firstBarOfDay then pp + (1 * delta) else if lastBarOfDay then nan else r6[1];
def r7 = if firstBarOfDay then pp + (1.236 * delta) else if lastBarOfDay then nan else r7[1];
def r8 = if firstBarOfDay then pp + (1.618 * delta) else if lastBarOfDay then nan else r8[1];

plot ppp = pp;
plot ps0 = s0;
plot ps1 = s1;
plot ps2 = s2;
plot ps3 = s3;
plot ps4 = s4;
plot ps5 = s5;
plot pr0 = r0;
plot pr1 = r1;
plot pr2 = r2;
plot pr3 = r3;
plot pr4 = r4;
plot pr5 = r5;
plot pr6 = r6;
plot pr7 = r7;
plot pr8 = r8;

ppp.SetDefaultColor(Color.WHITE);
ps0.SetDefaultColor(Color.GREEN);
ps1.SetDefaultColor(Color.GREEN);
ps2.SetDefaultColor(Color.GREEN);
ps3.SetDefaultColor(Color.GREEN);
ps4.SetDefaultColor(Color.GREEN);
ps5.SetDefaultColor(CREATEColor(231,133,0));
pr0.SetDefaultColor(Color.light_RED);
pr1.SetDefaultColor(Color.light_RED);
pr2.SetDefaultColor(Color.light_RED);
pr3.SetDefaultColor(Color.light_RED);
pr4.SetDefaultColor(Color.light_RED);
pr5.SetDefaultColor(Color.light_RED);
pr6.SetDefaultColor(CREATEColor(231,133,0));
pr7.SetDefaultColor(Color.green);
pr8.SetDefaultColor(Color.GREEN);

input ShowTodayOnly = yes;

#Bubbles
input bubblemover = 125;
def b  = bubblemover;
def b1 = b + 1;

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(PP[b1]) and !IsNaN(PP[b]), PP[b], "Pivot", GlobalColor("D"));

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R0[b1]) and !IsNaN(R0[b]), R0[b], "23.6%", GlobalColor("D"), Labelson);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R3[b1]) and !IsNaN(R3[b]), R3[b], "61.8%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R5[b1]) and !IsNaN(R5[b]), R5[b], "88.6%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R7[b1]) and !IsNaN(R7[b]), R7[b], "123.6%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R8[b1]) and !IsNaN(R8[b]), R8[b], "161.8%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S0[b1]) and !IsNaN(S0[b]), S0[b], "-27.2%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S1[b1]) and !IsNaN(S1[b]), S1[b], "-38.2%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S3[b1]) and !IsNaN(S3[b]), S3[b], "-61.8%", GlobalColor("D"), LabelsOn);``````

Replace the one's in the script with these and see if that helps

Ruby:
``````def firstBarOfDay = #if (beforeStart[1] == 1 and beforeStart == 0) or (isRollover and beforeStart == 0)
if secondsfromTime(0300)>=0 then 1 else 0;
def lastBarOfDay = if secondstillTime(1859)>=0
#(afterEnd[-1] == 1 and afterEnd == 0) or
#(isRollover[-1] and firstBarOfDay[-1])
then 1
else 0;``````

Replace the one's in the script with these and see if that helps
Thanks for the reply. Im getting an error. Says "No such variable: nan at 85:79"

Thanks for the reply. Im getting an error. Says "No such variable: nan at 85:79"
Here's the full code.

Ruby:
``````# 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;
input LabelsOn = yes;

#
# 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)
if secondsfromTime(0300)>=0 then 1 else 0;
def lastBarOfDay = if secondstillTime(1859)>=0
#(afterEnd[-1] == 1 and afterEnd == 0) or
#(isRollover[-1] and firstBarOfDay[-1])
then 1
else 0;

#
# https://www.interactivebrokers.com/en/software/tws/usersguidebook/technicalanalytics/fibonaccipivotpoints.htm
# Pivot Point (P) = (High + Low + Close)/3
# Support 0 (S0) = P- {.236 * (High - Low)}
# Support 1 (S1) = P - {.382 * (High - Low)}
# Support 2 (S2) = P - {.5 * (High - Low)}
# Support 3 (S3) = P - {.618 * (High - Low)}
# Support 4 (S4) = P - {.764 * (High - Low)}
# Support 5 (S5) = P - {1 * (High - Low)}
# Resistance 0 (R0) = P + {.236 * (High - Low)}
# Resistance 1 (R1) = P + {.382 * (High - Low)}
# Resistance 2 (R2) = P + {.5 * (High - Low)}
# Resistance 3 (R3) = P + {.618 * (High - Low)}
# Resistance 4 (R4) = P + {.764 * (High - Low)}
# Resistance 5 (R5) = P + {1 * (High - Low)}
# Resistance 5 (R6) = P + {1.236 * (High - Low)}
# Resistance 5 (R7) = P + {1.618 * (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 0 (S0) = P - {.236 * (High - Low)}
#Support 1 (S1) = P - {.382 * (High - Low)}
#Support 2 (S2) = P - {.5 * (High - Low)}
#Support 3 (S3) = P - {.618 * (High - Low)}
#Support 3 (S4) = P - {.764 * (High - Low)}
#Support 4 (S5) = P - {1 * (High - Low)}
#Resistance 0 (R0) = P + {.236 * (High - Low)}
#Resistance 1 (R1) = P + {.382 * (High - Low)}
#Resistance 2 (R2) = P + {.5 * (High - Low)}
#Resistance 3 (R3) = P + {.618 * (High - Low)}
#Resistance 4 (R4) = P + {.764 * (High - Low)}
#Resistance 5 (R5) = P + {1 * (High - Low)}
#Resistance 6 (R6) = P + {1.272 * (High - Low)}
#Resistance 7 (R7) = P + {1.618 * (High - Low)}

def delta = ph - pl;
def pp = if firstBarOfDay then (pc + ph + pl) / 3 else if lastBarOfDay then nan else pp[1];
def s0 = if firstBarOfDay then pp - (.272 * delta) else if lastBarOfDay then nan else s0[1];
def s1 = if firstBarOfDay then pp - (.382 * delta) else if lastBarOfDay then nan else s1[1];
def s2 = if firstBarOfDay then pp - (.5 * delta) else if lastBarOfDay then nan else s2[1];
def s3 = if firstBarOfDay then pp - (.618 * delta) else if lastBarOfDay then nan else s3[1];
def s4 = if firstBarOfDay then pp - (.786 * delta) else if lastBarOfDay then nan else s4[1];
def s5 = if firstBarOfDay then pp - (1 * delta) else if lastBarOfDay then nan else s5[1];
def r0 = if firstBarOfDay then pp + (.236 * delta) else if lastBarOfDay then nan else r0[1];
def r1 = if firstBarOfDay then pp + (.382 * delta) else if lastBarOfDay then nan else r1[1];
def r2 = if firstBarOfDay then pp + (.5 * delta) else if lastBarOfDay then nan else r2[1];
def r3 = if firstBarOfDay then pp + (.618 * delta) else if lastBarOfDay then nan else r3[1];
def r4 = if firstBarOfDay then pp + (.786 * delta) else if lastBarOfDay then nan else r4[1];
def r5 = if firstBarOfDay then pp + (.886 * delta) else if lastBarOfDay then nan else r5[1];
def r6 = if firstBarOfDay then pp + (1 * delta) else if lastBarOfDay then nan else r6[1];
def r7 = if firstBarOfDay then pp + (1.236 * delta) else if lastBarOfDay then nan else r7[1];
def r8 = if firstBarOfDay then pp + (1.618 * delta) else if lastBarOfDay then nan else r8[1];

plot ppp = pp;
plot ps0 = s0;
plot ps1 = s1;
plot ps2 = s2;
plot ps3 = s3;
plot ps4 = s4;
plot ps5 = s5;
plot pr0 = r0;
plot pr1 = r1;
plot pr2 = r2;
plot pr3 = r3;
plot pr4 = r4;
plot pr5 = r5;
plot pr6 = r6;
plot pr7 = r7;
plot pr8 = r8;

ppp.SetDefaultColor(Color.WHITE);
ps0.SetDefaultColor(Color.GREEN);
ps1.SetDefaultColor(Color.GREEN);
ps2.SetDefaultColor(Color.GREEN);
ps3.SetDefaultColor(Color.GREEN);
ps4.SetDefaultColor(Color.GREEN);
ps5.SetDefaultColor(CREATEColor(231,133,0));
pr0.SetDefaultColor(Color.light_RED);
pr1.SetDefaultColor(Color.light_RED);
pr2.SetDefaultColor(Color.light_RED);
pr3.SetDefaultColor(Color.light_RED);
pr4.SetDefaultColor(Color.light_RED);
pr5.SetDefaultColor(Color.light_RED);
pr6.SetDefaultColor(CREATEColor(231,133,0));
pr7.SetDefaultColor(Color.green);
pr8.SetDefaultColor(Color.GREEN);

#input ShowTodayOnly = yes;

#Bubbles
input bubblemover = 125;
def b  = bubblemover;
def b1 = b + 1;

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(PP[b1]) and !IsNaN(PP[b]), PP[b], "Pivot", GlobalColor("D"));

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R0[b1]) and !IsNaN(R0[b]), R0[b], "23.6%", GlobalColor("D"), Labelson);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R3[b1]) and !IsNaN(R3[b]), R3[b], "61.8%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R5[b1]) and !IsNaN(R5[b]), R5[b], "88.6%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R7[b1]) and !IsNaN(R7[b]), R7[b], "123.6%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(R8[b1]) and !IsNaN(R8[b]), R8[b], "161.8%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S0[b1]) and !IsNaN(S0[b]), S0[b], "-27.2%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S1[b1]) and !IsNaN(S1[b]), S1[b], "-38.2%", GlobalColor("D"), LabelsOn);

DefineGlobalColor("D”, CreateColor(133, 163, 104));
AddChartBubble(LabelsOn and IsNaN(S3[b1]) and !IsNaN(S3[b]), S3[b], "-61.8%", GlobalColor("D"), LabelsOn);``````

87k+ Posts
228 Online

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