Camarilla Pivot Points for ThinkOrSwim

I was wondering if anyone knew how to edit the plot time for these Camarilla Pivots to look like my IB_Pivot script. I'm guessing it has to do with premarket information perhaps? Basically would like the plotted lines to be within RTH
PP-1.png

PP-2.png




Camarilla Code

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2021
#Original by SleepyZ: https://usethinkscript.com/threads/camarilla-pivot-points-for-thinkorswim.696/post-77438
#R5 & S5 Added by Wiinii
#Added showtodayonly

input showtodayonly     = yes;
input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 1;
input hide_s1_r1 = yes;
input lines = {default dashes, points, triangles, horizontal, squares};
input showbubbles_description = yes;
input showpricebubble = yes;

Assert(length > 0, "'length' should be positive: " + length);

def yyyymmdd = GetYYYYMMDD();
def month = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def period;
switch (aggregationPeriod) {
case DAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = Floor(day_number / 7);
case MONTH:
    period = Floor(month - First(month));
}
def count       = CompoundValue(1,
if period != period[1]
then (count[1] + period - period[1]) % length
else count[1], 0);

def start       = CompoundValue(1, count < count[1] + period - period[1], yes);

def highValue   = CompoundValue(1,
                  if start
                  then Highest(high(period = aggregationPeriod), length)[1]
                  else if highValue[1] != 0
                  then highValue[1]
                  else Double.NaN, high);

def lowValue    = CompoundValue(1,
                  if start
                  then Lowest(low(period = aggregationPeriod), length)[1]
                  else if lowValue[1] != 0
                  then lowValue[1]
                  else Double.NaN, low);

def closeValue  = if showtodayonly and GetDay() != GetLastDay()
                  then Double.NaN
                  else if start then close(period = aggregationPeriod)[1]
                  else closeValue[1];

def range = highValue - lowValue;

plot R6 = (highValue / lowValue) * closeValue;
plot R4 = closeValue + range * (1.1) / 2;
plot R3 = closeValue + range * (1.1) / 4;
plot R5 = R4 + 1.168 * (R4 – R3);
plot R2 = closeValue + range * (1.1) / 6;
plot R1 = closeValue + range * (1.1) / 12;
plot S1 = closeValue - range * (1.1) / 12;
plot S2 = closeValue - range * (1.1) / 6;
plot S3 = closeValue - range * (1.1) / 4;
plot S4 = closeValue - range * (1.1) / 2;
plot S5 = S4 - 1.168 * (S3 - S4);
plot S6 = (closeValue - (R6 - closeValue));

R1.SetHiding(hide_s1_r1);
S1.SetHiding(hide_s1_r1);

R6.SetDefaultColor(GetColor(5));
R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(GetColor(5));
R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S4.SetDefaultColor(GetColor(6));
S5.SetDefaultColor(GetColor(6));
S6.SetDefaultColor(GetColor(6));

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;

R6.SetPaintingStrategy(paintingStrategy);
R5.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);
S4.SetPaintingStrategy(paintingStrategy);
S5.SetPaintingStrategy(paintingStrategy);
S6.SetPaintingStrategy(paintingStrategy);

#Bubbles to describe Pivot Levels

input bubblemover = 8;
def n = bubblemover;
def n1 = n + 1;

def StartPlot = if showbubbles_description == yes then (IsNaN(close[n]) and !IsNaN(close[n1])) else Double.NaN;


AddChartBubble(StartPlot, R6[n1], "R6 " + (if showpricebubble then AsText(R6[n1]) else ""), Color.RED, if close[n1] > R6[n1] then no else yes);
AddChartBubble(StartPlot, R5[n1], "R5 " + (if showpricebubble then AsText(R5[n1]) else ""), Color.RED, if close[n1] > R5[n1] then no else yes);
AddChartBubble(StartPlot, R4[n1], "R4 " + (if showpricebubble then AsText(R4[n1]) else ""), Color.RED, if close[n1] > R4[n1] then no else yes);
AddChartBubble(StartPlot, R3[n1], "R3 " + (if showpricebubble then AsText(R3[n1]) else ""), Color.RED, if close[n1] > R3[n1] then no else yes);
AddChartBubble(StartPlot, R2[n1], "R2 " + (if showpricebubble then AsText(R2[n1]) else ""), Color.RED, if close[n1] > R2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, R1[n1], "R1 " + (if showpricebubble then AsText(R1[n1]) else ""), Color.RED, if close[n1] > R1[n1] then no else yes);

AddChartBubble(StartPlot, S6[n1], "S6 " + (if showpricebubble then AsText(S6[n1]) else ""), Color.GREEN, if close[n1] > S6[n1] then no else yes);
AddChartBubble(StartPlot, S5[n1], "S5 " + (if showpricebubble then AsText(S5[n1]) else ""), Color.GREEN, if close[n1] > S5[n1] then no else yes);
AddChartBubble(StartPlot, S4[n1], "S4 " + (if showpricebubble then AsText(S4[n1]) else ""), Color.GREEN, if close[n1] > S4[n1] then no else yes);
AddChartBubble(StartPlot, S3[n1], "S3 " + (if showpricebubble then AsText(S3[n1]) else ""), Color.GREEN, if close[n1] > S3[n1] then no else yes);
AddChartBubble(StartPlot, S2[n1], "S2 " + (if showpricebubble then AsText(S2[n1]) else ""), Color.GREEN, if close[n1] > S2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, S1[n1], "S1 " + (if showpricebubble then AsText(S1[n1]) else ""), Color.GREEN, if close[n1] > S1[n1] then no else yes);

R1.HideBubble();
R2.HideBubble();
R3.HideBubble();
R4.HideBubble();
R5.HideBubble();
R6.HideBubble();

S1.HideBubble();
S2.HideBubble();
S3.HideBubble();
S4.HideBubble();
S5.HideBubble();
S6.HideBubble();

IB Pivot Code

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;

#
# See this page for how to calculate the indicator
# 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)}
# Support 6 (S6) = P - {1.236 * (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 4 (S4) = P - {.764 * (High - Low)}
#Support 5 (S5) = P - {1 * (High - Low)}
#Support 5 (S5) = P - {1.236 * (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 s6 = if firstBarOfDay then pp - (1.236 * delta) else if lastBarOfDay then nan else s6[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 ps6 = s6;
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.BLUE);
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));
ps6.SetDefaultColor(Color.GREEN);
pS6.SetPaintingStrategy(PaintingStrategy.LINE);
pS6.SetStyle(Curve.SHORT_DASH);
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.LIGHT_RED);
pr7.SetPaintingStrategy(PaintingStrategy.LINE);
pr7.SetStyle(Curve.SHORT_DASH);
pr8.SetDefaultColor(Color.LIGHT_RED);
pr8.SetPaintingStrategy(PaintingStrategy.LINE);
pr8.SetStyle(Curve.SHORT_DASH);

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


def Yesterday = GetDay() == GetLastDay() - 1;
def BubbleLocation = !yesterday and yesterday[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(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);

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

AddChartBubble(BubbleLocation, S5, "100%", Color.DARK_GRAY, yes);

This provides options to show only rthrs

Capture.jpg
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2021
#Original by SleepyZ: https://usethinkscript.com/threads/camarilla-pivot-points-for-thinkorswim.696/post-77438
#R5 & S5 Added by Wiinii
#Added showtodayonly

input showtodayonly     = no;
input showrthrsonly     = yes;
input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 1;
input hide_s1_r1 = yes;
input lines = {default dashes, points, triangles, horizontal, squares};
input showbubbles     = yes;
input showpricebubble = yes;

Assert(length > 0, "'length' should be positive: " + length);

def yyyymmdd = GetYYYYMMDD();
def month = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def period;
switch (aggregationPeriod) {
case DAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = Floor(day_number / 7);
case MONTH:
    period = Floor(month - First(month));
}
def count       = CompoundValue(1,
if period != period[1]
then (count[1] + period - period[1]) % length
else count[1], 0);



def start       = CompoundValue(1, count < count[1] + period - period[1], yes);

def highValue   = CompoundValue(1,
                  if start
                  then Highest(high(period = aggregationPeriod), length)[1]
                  else if highValue[1] != 0
                  then highValue[1]
                  else Double.NaN, high);

def lowValue    = CompoundValue(1,
                  if start
                  then Lowest(low(period = aggregationPeriod), length)[1]
                  else if lowValue[1] != 0
                  then lowValue[1]
                  else Double.NaN, low);

def closeValue  = if showtodayonly and GetDay() != GetLastDay()
                  then Double.NaN
                  else if start
                  then close(period = aggregationPeriod)[1]
                  else closeValue[1];

def range = highValue - lowValue;
def rthrs      = between(gettime(), regularTradingStart(getyyyYMMDD()), regularTradingEnd(getyyyYMMDD()));
plot R6 = if showrthrsonly and !rthrs then double.nan else (highValue / lowValue) * closeValue;
plot R4 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 2;
plot R3 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 4;
plot R5 = if showrthrsonly and  !rthrs then double.nan else R4 + 1.168 * (R4 – R3);
plot R2 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 6;
plot R1 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 12;
plot S1 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 12;
plot S2 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 6;
plot S3 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 4;
plot S4 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 2;
plot S5 = if showrthrsonly and  !rthrs then double.nan else S4 - 1.168 * (S3 - S4);
plot S6 = if showrthrsonly and  !rthrs then double.nan else (closeValue - (R6 - closeValue));

R1.SetHiding(hide_s1_r1);
S1.SetHiding(hide_s1_r1);

R6.SetDefaultColor(GetColor(5));
R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(GetColor(5));
R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S4.SetDefaultColor(GetColor(6));
S5.SetDefaultColor(GetColor(6));
S6.SetDefaultColor(GetColor(6));

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;

R6.SetPaintingStrategy(paintingStrategy);
R5.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);
S4.SetPaintingStrategy(paintingStrategy);
S5.SetPaintingStrategy(paintingStrategy);
S6.SetPaintingStrategy(paintingStrategy);

#Bubbles to describe Pivot Levels

input bubblemover = 8;
def n = bubblemover;
def n1 = n + 1;

def StartPlot = if showbubbles and !showrthrsonly then (IsNaN(close[n]) and !IsNaN(close[n1])) else if showbubbles and showrthrsonly then rthrs[n1]==1 and rthrs[n]==0  else Double.NaN;


AddChartBubble(StartPlot, R6[n1], "R6 " + (if showpricebubble then AsText(R6[n1]) else ""), Color.RED, if close[n1] > R6[n1] then no else yes);
AddChartBubble(StartPlot, R5[n1], "R5 " + (if showpricebubble then AsText(R5[n1]) else ""), Color.RED, if close[n1] > R5[n1] then no else yes);
AddChartBubble(StartPlot, R4[n1], "R4 " + (if showpricebubble then AsText(R4[n1]) else ""), Color.RED, if close[n1] > R4[n1] then no else yes);
AddChartBubble(StartPlot, R3[n1], "R3 " + (if showpricebubble then AsText(R3[n1]) else ""), Color.RED, if close[n1] > R3[n1] then no else yes);
AddChartBubble(StartPlot, R2[n1], "R2 " + (if showpricebubble then AsText(R2[n1]) else ""), Color.RED, if close[n1] > R2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, R1[n1], "R1 " + (if showpricebubble then AsText(R1[n1]) else ""), Color.RED, if close[n1] > R1[n1] then no else yes);

AddChartBubble(StartPlot, S6[n1], "S6 " + (if showpricebubble then AsText(S6[n1]) else ""), Color.GREEN, if close[n1] > S6[n1] then no else yes);
AddChartBubble(StartPlot, S5[n1], "S5 " + (if showpricebubble then AsText(S5[n1]) else ""), Color.GREEN, if close[n1] > S5[n1] then no else yes);
AddChartBubble(StartPlot, S4[n1], "S4 " + (if showpricebubble then AsText(S4[n1]) else ""), Color.GREEN, if close[n1] > S4[n1] then no else yes);
AddChartBubble(StartPlot, S3[n1], "S3 " + (if showpricebubble then AsText(S3[n1]) else ""), Color.GREEN, if close[n1] > S3[n1] then no else yes);
AddChartBubble(StartPlot, S2[n1], "S2 " + (if showpricebubble then AsText(S2[n1]) else ""), Color.GREEN, if close[n1] > S2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, S1[n1], "S1 " + (if showpricebubble then AsText(S1[n1]) else ""), Color.GREEN, if close[n1] > S1[n1] then no else yes);

R1.HideBubble();
R2.HideBubble();
R3.HideBubble();
R4.HideBubble();
R5.HideBubble();
R6.HideBubble();

S1.HideBubble();
S2.HideBubble();
S3.HideBubble();
S4.HideBubble();
S5.HideBubble();
S6.HideBubble();
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

This provides options to show only rthrs
I made an edit to the bubble code now that I see how it is working during active regular trading hours.
Capture.jpg
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2021
#Original by SleepyZ: https://usethinkscript.com/threads/camarilla-pivot-points-for-thinkorswim.696/post-77438
#R5 & S5 Added by Wiinii
#Added showtodayonly

input showtodayonly     = no;
input showrthrsonly     = yes;
input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 1;
input hide_s1_r1 = yes;
input lines = {default dashes, points, triangles, horizontal, squares};
input showbubbles     = yes;
input showpricebubble = yes;

Assert(length > 0, "'length' should be positive: " + length);

def yyyymmdd = GetYYYYMMDD();
def month = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def period;
switch (aggregationPeriod) {
case DAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = Floor(day_number / 7);
case MONTH:
    period = Floor(month - First(month));
}
def count       = CompoundValue(1,
if period != period[1]
then (count[1] + period - period[1]) % length
else count[1], 0);



def start       = CompoundValue(1, count < count[1] + period - period[1], yes);

def highValue   = CompoundValue(1,
                  if start
                  then Highest(high(period = aggregationPeriod), length)[1]
                  else if highValue[1] != 0
                  then highValue[1]
                  else Double.NaN, high);

def lowValue    = CompoundValue(1,
                  if start
                  then Lowest(low(period = aggregationPeriod), length)[1]
                  else if lowValue[1] != 0
                  then lowValue[1]
                  else Double.NaN, low);

def closeValue  = if showtodayonly and GetDay() != GetLastDay()
                  then Double.NaN
                  else if start
                  then close(period = aggregationPeriod)[1]
                  else closeValue[1];

def range = highValue - lowValue;
def rthrs      = between(gettime(), regularTradingStart(getyyyYMMDD()), regularTradingEnd(getyyyYMMDD()));
plot R6 = if showrthrsonly and !rthrs then double.nan else (highValue / lowValue) * closeValue;
plot R4 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 2;
plot R3 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 4;
plot R5 = if showrthrsonly and  !rthrs then double.nan else R4 + 1.168 * (R4 – R3);
plot R2 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 6;
plot R1 = if showrthrsonly and  !rthrs then double.nan else closeValue + range * (1.1) / 12;
plot S1 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 12;
plot S2 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 6;
plot S3 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 4;
plot S4 = if showrthrsonly and  !rthrs then double.nan else closeValue - range * (1.1) / 2;
plot S5 = if showrthrsonly and  !rthrs then double.nan else S4 - 1.168 * (S3 - S4);
plot S6 = if showrthrsonly and  !rthrs then double.nan else (closeValue - (R6 - closeValue));

R1.SetHiding(hide_s1_r1);
S1.SetHiding(hide_s1_r1);

R6.SetDefaultColor(GetColor(5));
R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(GetColor(5));
R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S4.SetDefaultColor(GetColor(6));
S5.SetDefaultColor(GetColor(6));
S6.SetDefaultColor(GetColor(6));

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;

R6.SetPaintingStrategy(paintingStrategy);
R5.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);
S4.SetPaintingStrategy(paintingStrategy);
S5.SetPaintingStrategy(paintingStrategy);
S6.SetPaintingStrategy(paintingStrategy);

#Bubbles to describe Pivot Levels

input bubblemover = 8;
def n = bubblemover;
def n1 = n + 1;

def StartPlot = if showbubbles then (IsNaN(close[n]) and !IsNaN(close[n1])) else Double.NaN;

AddChartBubble(StartPlot, R6[n1], "R6 " + (if showpricebubble then AsText(R6[n1]) else ""), Color.RED, if close[n1] > R6[n1] then no else yes);
AddChartBubble(StartPlot, R5[n1], "R5 " + (if showpricebubble then AsText(R5[n1]) else ""), Color.RED, if close[n1] > R5[n1] then no else yes);
AddChartBubble(StartPlot, R4[n1], "R4 " + (if showpricebubble then AsText(R4[n1]) else ""), Color.RED, if close[n1] > R4[n1] then no else yes);
AddChartBubble(StartPlot, R3[n1], "R3 " + (if showpricebubble then AsText(R3[n1]) else ""), Color.RED, if close[n1] > R3[n1] then no else yes);
AddChartBubble(StartPlot, R2[n1], "R2 " + (if showpricebubble then AsText(R2[n1]) else ""), Color.RED, if close[n1] > R2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, R1[n1], "R1 " + (if showpricebubble then AsText(R1[n1]) else ""), Color.RED, if close[n1] > R1[n1] then no else yes);

AddChartBubble(StartPlot, S6[n1], "S6 " + (if showpricebubble then AsText(S6[n1]) else ""), Color.GREEN, if close[n1] > S6[n1] then no else yes);
AddChartBubble(StartPlot, S5[n1], "S5 " + (if showpricebubble then AsText(S5[n1]) else ""), Color.GREEN, if close[n1] > S5[n1] then no else yes);
AddChartBubble(StartPlot, S4[n1], "S4 " + (if showpricebubble then AsText(S4[n1]) else ""), Color.GREEN, if close[n1] > S4[n1] then no else yes);
AddChartBubble(StartPlot, S3[n1], "S3 " + (if showpricebubble then AsText(S3[n1]) else ""), Color.GREEN, if close[n1] > S3[n1] then no else yes);
AddChartBubble(StartPlot, S2[n1], "S2 " + (if showpricebubble then AsText(S2[n1]) else ""), Color.GREEN, if close[n1] > S2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, S1[n1], "S1 " + (if showpricebubble then AsText(S1[n1]) else ""), Color.GREEN, if close[n1] > S1[n1] then no else yes);

R1.HideBubble();
R2.HideBubble();
R3.HideBubble();
R4.HideBubble();
R5.HideBubble();
R6.HideBubble();

S1.HideBubble();
S2.HideBubble();
S3.HideBubble();
S4.HideBubble();
S5.HideBubble();
S6.HideBubble();
 
I made an edit to the bubble code now that I see how it is working during active regular trading hours.

Im guessing its for the placement? Thanks again! Used the script today :)

BTW, Would you be able to provide a PIVOT plot?

ALSO, just replaced this script but I'm not seeing the bubbles even with "BUBBLESON.
 
Last edited:
Im guessing its for the placement? Thanks again! Used the script today :)

BTW, Would you be able to provide a PIVOT plot?

ALSO, just replaced this script but I'm not seeing the bubbles even with "BUBBLESON.

I added a Pivot plot. The bubbles were only for the last day above. However, now you can choose to display them if you have prior days showing.

Capture.jpg
Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2021
#Original by SleepyZ: https://usethinkscript.com/threads/camarilla-pivot-points-for-thinkorswim.696/post-77438
#R5 & S5 Added by Wiinii
#Added showtodayonly

input showtodayonly        = no;
input showrthrsonly        = yes;
input aggregationPeriod    = {default "DAY", "WEEK", "MONTH"};
input length               = 1;
input hide_s1_r1           = yes;
input lines                = {default dashes, points, triangles, horizontal, squares};
input showbubbles          = yes;
input showbubblespriordays = yes;
input showpricebubble      = yes;

Assert(length > 0, "'length' should be positive: " + length);

def yyyymmdd   = GetYYYYMMDD();
def month      = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def period;
switch (aggregationPeriod) {
case DAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = Floor(day_number / 7);
case MONTH:
    period = Floor(month - First(month));
}
def count       = CompoundValue(1,
if period != period[1]
then (count[1] + period - period[1]) % length
else count[1], 0);



def start       = CompoundValue(1, count < count[1] + period - period[1], yes);

def highValue   = CompoundValue(1,
                  if start
                  then Highest(high(period = aggregationPeriod), length)[1]
                  else if highValue[1] != 0
                  then highValue[1]
                  else Double.NaN, high);

def lowValue    = CompoundValue(1,
                  if start
                  then Lowest(low(period = aggregationPeriod), length)[1]
                  else if lowValue[1] != 0
                  then lowValue[1]
                  else Double.NaN, low);

def closeValue  = if showtodayonly and GetDay() != GetLastDay()
                  then Double.NaN
                  else if start
                  then close(period = aggregationPeriod)[1]
                  else closeValue[1];

def range = highValue - lowValue;
def rthrs      = Between(GetTime(), RegularTradingStart(GetYYYYMMDD()), RegularTradingEnd(GetYYYYMMDD()));
plot R6 = if showrthrsonly and !rthrs then Double.NaN else (highValue / lowValue) * closeValue;
plot R4 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 2;
plot R3 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 4;
plot R5 = if showrthrsonly and  !rthrs then Double.NaN else R4 + 1.168 * (R4 – R3);
plot R2 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 6;
plot R1 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 12;
plot Pivot = if showrthrsonly and  !rthrs then Double.NaN else (highValue + closeValue + lowValue) / 3;
plot S1 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 12;
plot S2 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 6;
plot S3 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 4;
plot S4 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 2;
plot S5 = if showrthrsonly and  !rthrs then Double.NaN else S4 - 1.168 * (S3 - S4);
plot S6 = if showrthrsonly and  !rthrs then Double.NaN else (closeValue - (R6 - closeValue));

R1.SetHiding(hide_s1_r1);
S1.SetHiding(hide_s1_r1);

R6.SetDefaultColor(GetColor(5));
R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(GetColor(5));
R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
Pivot.SetDefaultColor(Color.CYAN);
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S4.SetDefaultColor(GetColor(6));
S5.SetDefaultColor(GetColor(6));
S6.SetDefaultColor(GetColor(6));

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;

R6.SetPaintingStrategy(paintingStrategy);
R5.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
Pivot.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);
S4.SetPaintingStrategy(paintingStrategy);
S5.SetPaintingStrategy(paintingStrategy);
S6.SetPaintingStrategy(paintingStrategy);

#Bubbles to describe Pivot Levels

input bubblemover = 8;
def n = bubblemover;
def n1 = n + 1;

def StartPlot = if showbubbles and getday()==getlastday() then (IsNaN(close[n]) and !IsNaN(close[n1])) else if showbubbles and showbubblespriordays then rthrs[n1] == 1 and rthrs[n] == 0 else Double.NaN;

AddChartBubble(StartPlot, R6[n1], "R6 " + (if showpricebubble then AsText(R6[n1]) else ""), Color.RED, if close[n1] > R6[n1] then no else yes);
AddChartBubble(StartPlot, R5[n1], "R5 " + (if showpricebubble then AsText(R5[n1]) else ""), Color.RED, if close[n1] > R5[n1] then no else yes);
AddChartBubble(StartPlot, R4[n1], "R4 " + (if showpricebubble then AsText(R4[n1]) else ""), Color.RED, if close[n1] > R4[n1] then no else yes);
AddChartBubble(StartPlot, R3[n1], "R3 " + (if showpricebubble then AsText(R3[n1]) else ""), Color.RED, if close[n1] > R3[n1] then no else yes);
AddChartBubble(StartPlot, R2[n1], "R2 " + (if showpricebubble then AsText(R2[n1]) else ""), Color.RED, if close[n1] > R2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, R1[n1], "R1 " + (if showpricebubble then AsText(R1[n1]) else ""), Color.RED, if close[n1] > R1[n1] then no else yes);

AddChartBubble(StartPlot, Pivot[n1], "Pivot " + (if showpricebubble then AsText(Pivot[n1]) else ""), Pivot.TakeValueColor(), if close[n1] > Pivot[n1] then no else yes);

AddChartBubble(StartPlot, S6[n1], "S6 " + (if showpricebubble then AsText(S6[n1]) else ""), Color.GREEN, if close[n1] > S6[n1] then no else yes);
AddChartBubble(StartPlot, S5[n1], "S5 " + (if showpricebubble then AsText(S5[n1]) else ""), Color.GREEN, if close[n1] > S5[n1] then no else yes);
AddChartBubble(StartPlot, S4[n1], "S4 " + (if showpricebubble then AsText(S4[n1]) else ""), Color.GREEN, if close[n1] > S4[n1] then no else yes);
AddChartBubble(StartPlot, S3[n1], "S3 " + (if showpricebubble then AsText(S3[n1]) else ""), Color.GREEN, if close[n1] > S3[n1] then no else yes);
AddChartBubble(StartPlot, S2[n1], "S2 " + (if showpricebubble then AsText(S2[n1]) else ""), Color.GREEN, if close[n1] > S2[n1] then no else yes);
AddChartBubble(StartPlot and hide_s1_r1 == no, S1[n1], "S1 " + (if showpricebubble then AsText(S1[n1]) else ""), Color.GREEN, if close[n1] > S1[n1] then no else yes);

R1.HideBubble();
R2.HideBubble();
R3.HideBubble();
R4.HideBubble();
R5.HideBubble();
R6.HideBubble();
Pivot.HideBubble();
S1.HideBubble();
S2.HideBubble();
S3.HideBubble();
S4.HideBubble();
S5.HideBubble();
S6.HideBubble();
 
I added a Pivot plot. The bubbles were only for the last day above. However, now you can choose to display them if you have prior days showing.

Not sure if its because of the pop due to CPI numbers but PIVOT seems to be have wrong input for many symbols. I was looking at the code but could not figure it out.

Screenshot-2022-08-10-122916.png
 
Not sure if its because of the pop due to CPI numbers but PIVOT seems to be have wrong input for many symbols. I was looking at the code but could not figure it out.

Screenshot-2022-08-10-122916.png
It is using high, low, close as defined in the script as highvalue, lowvalue and closevalue divided by 3. Camarillo Pivots are not based off a pivot like other pivot indicators. If you want some other value then let me know.
 
It is using high, low, close as defined in the script as highvalue, lowvalue and closevalue divided by 3. Camarillo Pivots are not based off a pivot like other pivot indicators. If you want some other value then let me know.

Thats the formula ive seen usually used. Thats why I figured it was just due to the news this morning. I'll let the market relax and see how pivot works later this week. Thanks again!
 
Thats the formula ive seen usually used. Thats why I figured it was just due to the news this morning. I'll let the market relax and see how pivot works later this week. Thanks again!

After looking at the bubble portion of the code further I found that changes to RTHrs made the bubble code not work properly. So I redid it, so that it will display the last aggregationperiod's bubbles whatever aggregation is selected and whether it displays just RTHrs or not. Hope it works properly now!

Capture.jpg

Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2021
#Original by SleepyZ: https://usethinkscript.com/threads/camarilla-pivot-points-for-thinkorswim.696/post-77438
#R5 & S5 Added by Wiinii
#Added showtodayonly

input showlastonly         = no;#hint showlastonly: Last AggregationPeriod Selected
input showrthrsonly        = yes;
input aggregationPeriod    = {default "DAY", "WEEK", "MONTH"};
input length               = 1;
input hide_s1_r1           = yes;
input lines                = {default dashes, points, triangles, horizontal, squares};
input showbubbles          = yes;
input showpricebubble      = yes;

Assert(length > 0, "'length' should be positive: " + length);

def yyyymmdd   = GetYYYYMMDD();
def month      = GetYear() * 12 + GetMonth();
def day_number = DaysFromDate(First(yyyymmdd)) + GetDayOfWeek(First(yyyymmdd));
def period;
switch (aggregationPeriod) {
case DAY:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = Floor(day_number / 7);
case MONTH:
    period = Floor(month - First(month));
}
def count       = CompoundValue(1,
if period != period[1]
then (count[1] + period - period[1]) % length
else count[1], 0);



def start       = CompoundValue(1, count < count[1] + period - period[1], yes);

def highValue   = CompoundValue(1,
                  if start
                  then Highest(high(period = aggregationPeriod), length)[1]
                  else if highValue[1] != 0
                  then highValue[1]
                  else Double.NaN, high);

def lowValue    = CompoundValue(1,
                  if start
                  then Lowest(low(period = aggregationPeriod), length)[1]
                  else if lowValue[1] != 0
                  then lowValue[1]
                  else Double.NaN, low);

def closeValue  = if showlastonly and
                  (if aggregationPeriod==aggregationPeriod."WEEK"
                   then GetWeek() != GetLastWeek()
                   else if aggregationPeriod==aggregationPeriod."MONTH"
                   then GetMonth() != GetLastMonth()
                   else getday() !=getlastday())
                  then Double.NaN
                  else if start
                  then close(period = aggregationPeriod)[1]
                  else closeValue[1];

def range = highValue - lowValue;
def rthrs      = Between(GetTime(), RegularTradingStart(GetYYYYMMDD()), RegularTradingEnd(GetYYYYMMDD()));
plot R6 = if showrthrsonly and !rthrs then Double.NaN else (highValue / lowValue) * closeValue;
plot R4 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 2;
plot R3 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 4;
plot R5 = if showrthrsonly and  !rthrs then Double.NaN else R4 + 1.168 * (R4 – R3);
plot R2 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 6;
plot R1 = if showrthrsonly and  !rthrs then Double.NaN else closeValue + range * (1.1) / 12;
plot Pivot = if showrthrsonly and  !rthrs then Double.NaN else (highValue + closeValue + lowValue) / 3;
plot S1 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 12;
plot S2 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 6;
plot S3 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 4;
plot S4 = if showrthrsonly and  !rthrs then Double.NaN else closeValue - range * (1.1) / 2;
plot S5 = if showrthrsonly and  !rthrs then Double.NaN else S4 - 1.168 * (S3 - S4);
plot S6 = if showrthrsonly and  !rthrs then Double.NaN else (closeValue - (R6 - closeValue));

R1.SetHiding(hide_s1_r1);
S1.SetHiding(hide_s1_r1);

R6.SetDefaultColor(GetColor(5));
R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(GetColor(5));
R3.SetDefaultColor(GetColor(5));
R2.SetDefaultColor(GetColor(5));
R1.SetDefaultColor(GetColor(5));
Pivot.SetDefaultColor(Color.CYAN);
S1.SetDefaultColor(GetColor(6));
S2.SetDefaultColor(GetColor(6));
S3.SetDefaultColor(GetColor(6));
S4.SetDefaultColor(GetColor(6));
S5.SetDefaultColor(GetColor(6));
S6.SetDefaultColor(GetColor(6));

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;

R6.SetPaintingStrategy(paintingStrategy);
R5.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy);
R3.SetPaintingStrategy(paintingStrategy);
R2.SetPaintingStrategy(paintingStrategy);
R1.SetPaintingStrategy(paintingStrategy);
Pivot.SetPaintingStrategy(paintingStrategy);
S1.SetPaintingStrategy(paintingStrategy);
S2.SetPaintingStrategy(paintingStrategy);
S3.SetPaintingStrategy(paintingStrategy);
S4.SetPaintingStrategy(paintingStrategy);
S5.SetPaintingStrategy(paintingStrategy);
S6.SetPaintingStrategy(paintingStrategy);

#Bubbles to describe Pivot Levels

input bubblemover = 10;
def n = bubblemover;
def n1 = n - 1;

AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(R6[n]) and IsNaN(R6[n1]), R6[n], "R6 " + (if showpricebubble then AsText(R6[n]) else ""), Color.RED, if close[n] > R6[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(R5[n]) and IsNaN(R5[n1]), R5[n], "R5 " + (if showpricebubble then AsText(R5[n]) else ""), Color.RED, if close[n] > R5[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(R4[n]) and IsNaN(R4[n1]), R4[n], "R4 " + (if showpricebubble then AsText(R4[n]) else ""), Color.RED, if close[n] > R4[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(R3[n]) and IsNaN(R3[n1]), R3[n], "R3 " + (if showpricebubble then AsText(R3[n]) else ""), Color.RED, if close[n] > R3[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(R2[n]) and IsNaN(R2[n1]), R2[n], "R2 " + (if showpricebubble then AsText(R2[n]) else ""), Color.RED, if close[n] > R2[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(R1[n]) and IsNaN(R1[n1]) and hide_s1_r1 == no, R1[n], "R1 " + (if showpricebubble then AsText(R1[n]) else ""), Color.RED, if close[n] > R1[n] then no else yes);

AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(Pivot[n]) and IsNaN(Pivot[n1]), Pivot[n], "Pivot " + (if showpricebubble then AsText(Pivot[n]) else ""), Pivot.TakeValueColor(), if close[n] > Pivot[n] then no else yes);

AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(S6[n]) and IsNaN(S6[n1]), S6[n], "S6 " + (if showpricebubble then AsText(S6[n]) else ""), Color.GREEN, if close[n] > S6[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(S5[n]) and IsNaN(S5[n1]), S5[n], "S5 " + (if showpricebubble then AsText(S5[n]) else ""), Color.GREEN, if close[n] > S5[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(S4[n]) and IsNaN(S4[n1]), S4[n], "S4 " + (if showpricebubble then AsText(S4[n]) else ""), Color.GREEN, if close[n] > S4[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(S3[n]) and IsNaN(S3[n1]), S3[n], "S3 " + (if showpricebubble then AsText(S3[n]) else ""), Color.GREEN, if close[n] > S3[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(S2[n]) and IsNaN(S2[n1]), S2[n], "S2 " + (if showpricebubble then AsText(S2[n]) else ""), Color.GREEN, if close[n] > S2[n] then no else yes);
AddChartBubble(if !showrthrsonly
               then showbubbles and !isnan(close[n]) and isnan(close[n1])
               else showbubbles and GetDay() == GetLastDay() and
                    GetTime() > RegularTradingEnd(GetYYYYMMDD()) and
                    !IsNaN(S1[n]) and IsNaN(S1[n1]) and hide_s1_r1 == no, S1[n], "S1 " + (if showpricebubble then AsText(S1[n]) else ""), Color.GREEN, if close[n] > S1[n] then no else yes);

R1.HideBubble();
R2.HideBubble();
R3.HideBubble();
R4.HideBubble();
R5.HideBubble();
R6.HideBubble();
Pivot.HideBubble();
S1.HideBubble();
S2.HideBubble();
S3.HideBubble();
S4.HideBubble();
S5.HideBubble();
S6.HideBubble();
 
Does anyone have any info, I've been searching for an indicator on the web with no luck. I'm interested in Frank Ochoa's Developing Camarilla 3 indicator, I tried the code in back of his book and tried looking for the code online, no luck. Anyone know why or maybe have the code I can copy? I like the developing levels, Thank you.
 
Does anyone have any info, I've been searching for an indicator on the web with no luck. I'm interested in Frank Ochoa's Developing Camarilla 3 indicator, I tried the code in back of his book and tried looking for the code online, no luck. Anyone know why or maybe have the code I can copy? I like the developing levels, Thank you.
I think Ben mentions Frank Ochoa in this script

https://usethinkscript.com/threads/central-pivot-range-cpr-indicator-for-thinkorswim.1305/
 
The TOS Camarillo Points does not include or explain how to use actual PP with the Camarillo Points.

You can however add the following PP code to the above code just after the definitions of the values used to compute the PP.

See the TOS Education Tab for a further explanation of how TOS recommends using this indicator.

Could you help me get me to take the weekly and monthly pivots... keeping the format...


declare hide_on_daily;
# FOXHOUND FLOOR PIVOTS MOBILE
#
# Version 1.0 - initial

input showCPR = yes;
input showCPRCloud = NO;



#def o = open;
def h = high;
def l = low;
def c = close;
def na = Double.NaN;
def dayStart = if GetYYYYMMDD() <> GetYYYYMMDD()[1] then GetTime() else dayStart[1];

def rollover = dayStart <> dayStart[1];

def dh = if rollover or h > dh[1] then h else dh[1];
def dl = if rollover or l < dl[1] then l else dl[1];

#if showOnlyToday and !IsNaN(close[-1])
def _PP = if IsNaN(close) then _PP[1] else (dh + dl + c) / 3;

# CPR

def _cp = if rollover then _PP[1] else _cp[1];

plot cp = if showCPR then _cp else na;

cp.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cp.SetDefaultColor(Color.MAGENTA);


# FLOOR PIVOTS
def _r1 = if rollover then
_PP[1] - 0.500 * (dh[1] - dl[1]) else _r1[1];
def _r2 = if rollover then
_PP[1] - 0.618 * (dh[1] - dl[1]) else _r2[1];


def _s1 = if rollover then
_PP[1] + 0.500 * (dh[1] - dl[1]) else _s1[1];
def _s2 = if rollover then
_PP[1] + 0.618 * (dh[1] - dl[1]) else _s2[1];



plot r2 = _r2 ;
plot r1 = _r1;
plot s1 = _s1;
plot s2 = _s2;



r2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
r1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

r2.SetDefaultColor(CreateColor(192, 0, 0));
r1.SetDefaultColor(CreateColor(255, 0, 0));
s1.SetDefaultColor(CreateColor(0, 255, 0));
s2.SetDefaultColor(CreateColor(0, 192, 0));
 
Could you help me get me to take the weekly and monthly pivots... keeping the format...


declare hide_on_daily;
# FOXHOUND FLOOR PIVOTS MOBILE
#
# Version 1.0 - initial

input showCPR = yes;
input showCPRCloud = NO;



#def o = open;
def h = high;
def l = low;
def c = close;
def na = Double.NaN;
def dayStart = if GetYYYYMMDD() <> GetYYYYMMDD()[1] then GetTime() else dayStart[1];

def rollover = dayStart <> dayStart[1];

def dh = if rollover or h > dh[1] then h else dh[1];
def dl = if rollover or l < dl[1] then l else dl[1];

#if showOnlyToday and !IsNaN(close[-1])
def _PP = if IsNaN(close) then _PP[1] else (dh + dl + c) / 3;

# CPR

def _cp = if rollover then _PP[1] else _cp[1];

plot cp = if showCPR then _cp else na;

cp.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cp.SetDefaultColor(Color.MAGENTA);


# FLOOR PIVOTS
def _r1 = if rollover then
_PP[1] - 0.500 * (dh[1] - dl[1]) else _r1[1];
def _r2 = if rollover then
_PP[1] - 0.618 * (dh[1] - dl[1]) else _r2[1];


def _s1 = if rollover then
_PP[1] + 0.500 * (dh[1] - dl[1]) else _s1[1];
def _s2 = if rollover then
_PP[1] + 0.618 * (dh[1] - dl[1]) else _s2[1];



plot r2 = _r2 ;
plot r1 = _r1;
plot s1 = _s1;
plot s2 = _s2;



r2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
r1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

r2.SetDefaultColor(CreateColor(192, 0, 0));
r1.SetDefaultColor(CreateColor(255, 0, 0));
s1.SetDefaultColor(CreateColor(0, 255, 0));
s2.SetDefaultColor(CreateColor(0, 192, 0));

There is an input to select the timeframe you want

Capture.jpg
Ruby:
declare hide_on_daily;
# FOXHOUND FLOOR PIVOTS MOBILE
#
# Version 1.0 - initial

input timeframe = {default DAY, WEEK, MONTH};
input showCPR = yes;
input showCPRCloud = NO;

#def o = open;
def h = high;
def l = low;
def c = close;
def na = Double.NaN;

def Start;
switch (timeframe){
case DAY:
    Start = GetYYYYMMDD() <> GetYYYYMMDD()[1];
case WEEK:
    Start = GetWeek() <> GetWeek()[1];
case MONTH:
    Start = GetMonth() <> GetMonth()[1];
}

def daystart = if Start then GetTime() else daystart[1];
def rollover = daystart <> daystart[1];

def dh = if rollover or h > dh[1] then h else dh[1];
def dl = if rollover or l < dl[1] then l else dl[1];

#if showOnlyToday and !IsNaN(close[-1])
def _PP = if IsNaN(close) then _PP[1] else (dh + dl + c) / 3;

# CPR

def _cp = if rollover then _PP[1] else _cp[1];

plot cp = if showCPR then _cp else na;

cp.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cp.SetDefaultColor(Color.MAGENTA);


# FLOOR PIVOTS
def _r1 = if rollover then
_PP[1] - 0.500 * (dh[1] - dl[1]) else _r1[1];
def _r2 = if rollover then
_PP[1] - 0.618 * (dh[1] - dl[1]) else _r2[1];


def _s1 = if rollover then
_PP[1] + 0.500 * (dh[1] - dl[1]) else _s1[1];
def _s2 = if rollover then
_PP[1] + 0.618 * (dh[1] - dl[1]) else _s2[1];



plot r2 = _r2 ;
plot r1 = _r1;
plot s1 = _s1;
plot s2 = _s2;



r2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
r1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
s2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

r2.SetDefaultColor(CreateColor(192, 0, 0));
r1.SetDefaultColor(CreateColor(255, 0, 0));
s1.SetDefaultColor(CreateColor(0, 255, 0));
s2.SetDefaultColor(CreateColor(0, 192, 0));
 
Ok, another question here. I'm on TOS attempting to use camarilla points, what should my settings be for- aggregation period and length? Sorry, new to all this. Thank you!
 
Ok, another question here. I'm on TOS attempting to use camarilla points, what should my settings be for- aggregation period and length? Sorry, new to all this. Thank you!

I would suggest starting out with the default aggregationperiod of DAY and a length of 1. This will give a plot of each DAY/WEEK/MONTH selected.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
266 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