Jump to content

We have moved to Discord. Please click here to join us in the Trading Terminal Discord server.



These forums are read-only.

Jinagt

CamarillaPoints in thinkorswim

Recommended Posts

Jinagt

Hi BBT family, 
After the amazing webinar by Thor about Camarilla Pivot points lots of members are asking how to add CamarillaPoints in thinkorswim. I would like to share my setup here.  

Step 1: Adding CamarillaPoints to the Chart Right click on the chart> Studies > Edit Studies> Search CamarillaPoints> Add selected > Double click on the CamarillaPoints then you can customize.

 

Step 2: CamarillaPoints Customization: I am attaching the customization picture , you need to repeat this for all the levels. if you choose different colors for each level you could easily distinguish between one another. 

Step3: Chart Scale: This part will correct the small candle size issue by adding these lines. Right click on the chart> Chart Scale> check only Fit study markers. ( If you check "Fit study" also you will see all the levels but the candles will be short. 

Hope this will help TOS users to setup CamarillaPoints.

CAM_Customization.PNG

CAM_Setup_Step1.PNG

ChartScale_CAM.PNG

 

 

Chart_With_FitStudy.PNG

Chart1_Without_FitStudy.PNG

Edited by Jinagt
  • Like 5

Share this post


Link to post
Share on other sites
Dr. Winston O'Boogie

Many thanks for posting this, Jinagt.  While I mainly use DAS, I was also investigating how to set up Camarilla points on Think or Swim this morning.  I sent a private message to the amazing KyleK29 asking him about this but I haven't heard back as of yet:  The TOS pivot point values are slightly different than those shown on DAS.  It seems that difference is perhaps due to the level one uses for the "close" (TOS uses the consensus "closing level" while DAS appears to use something a bit different.  For example, for the SPY levels today TOS uses 418.24 (DAS "agrees" that this was the "close" on May 25) but DAS uses 419.11 for the "close".  I'll post back here if and when I get an answer explaining the difference.  If you happen to know the answer, I'm all ears (which actually makes piercing a rather complicated task, but I digress).  

  • Like 1

Share this post


Link to post
Share on other sites
Luke

Hello. I have also been changing the code for the TOS camarilla pivots but dont get the same numbers as the DAS platform. I am including the premarket and postmarket data to get the high and low of the full day and havent been able to get the same results. For the close price, I am using the close of the 4pm bar. Would greatly appreciate if we can find whats going on so we can have the same S and R levels in TOS.

plot R4 = closeValue + (range * (1.1) / 2);
plot R3 = closeValue + (range * (1.1) / 4);
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);
 

  • Like 1

Share this post


Link to post
Share on other sites
krankyon

Hi- Did you ever figure out how to get the same pivot point values on TOS as DAS? 

Share this post


Link to post
Share on other sites
Luke

Hello

I did manage to create a script for TOS, but it doesnt work the same as DAS. I dont have DAS so I cant see what is the problem, but I noticed this differences when Thor posts high trades and I compare the levels and are not quite the same. If anyone can help us it would be great. I am sharing my code so we can build upon it. 

Luke_cdt

TOS code: 

input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 1;

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 = if start then Highest(high(period = AggregationPeriod.FOUR_HOURS), 6)[1] else if highValue[1] != 0 then highValue[1] else Double.NaN;

#plot x= highValue;

def lowValue = if start then Lowest(low(period = AggregationPeriod.FOUR_HOURS), 6)[1] else if lowValue[1] != 0 then lowValue[1] else Double.NaN;

#Plot y= lowValue;

def closeValue = if start then close(period =  aggregationPeriod)[1] else closeValue[1];

#plot z=closeValue;

def range = highValue - lowValue;

#plot R5 = closeValue + range ;
plot R4 = closeValue + (range * (1.1) / 2);
plot R3 = closeValue + (range * (1.1) / 4);
plot R2 = closeValue + (range * (1.1) / 6);
plot R1 = closeValue + (range * (1.1) / 12);
#plot PP = (highValue + lowValue + closeValue)/3 ;
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 = (closeValue - range);

#R1.Hide();
#S1.Hide();

#R5.SetDefaultColor(GetColor(5));
R4.SetDefaultColor(Color.GREEN);
R3.SetDefaultColor(Color.RED);
R2.SetDefaultColor(Color.GRAY);
R1.SetDefaultColor(Color.GRAY);
#PP.SetDefaultColor(Color.YELLOW);
S1.SetDefaultColor(Color.GRAY);
S2.SetDefaultColor(Color.GRAY);
S3.SetDefaultColor(Color.GREEN);
S4.SetDefaultColor(Color.RED);
#S5.SetDefaultColor(GetColor(6));


#R5.SetPaintingStrategy(paintingStrategy);
R4.SetPaintingStrategy(paintingStrategy.line);
R3.SetPaintingStrategy(paintingStrategy.line);
R2.SetPaintingStrategy(paintingStrategy.line);
R1.SetPaintingStrategy(paintingStrategy.line);
#PP.SetPaintingStrategy(paintingStrategy.line);
S1.SetPaintingStrategy(paintingStrategy.line);
S2.SetPaintingStrategy(paintingStrategy.line);
S3.SetPaintingStrategy(paintingStrategy.line);
S4.SetPaintingStrategy(paintingStrategy.line);
#S5.SetPaintingStrategy(paintingStrategy);

  • Like 1

Share this post


Link to post
Share on other sites
NTrader2021

The difference I've identified between the CamarillaPoints study in TOS (which is what I use) and the one in DAS is that the calculation used for "R5" and "S5" is actually the calculation for "R6" and "S6."  Meaning, the default study in TOS doesn't calculate "R5" and "S5." The equations for these two levels are missing: R5 = R4 + 1.168*(R4-R3) and S5 = S4-1.168*(S3-S4).

Furthermore, the default study is TOS only includes data during normal trading hours (0930-1600). Many of the moderators include data from premarket and aftermarket hours, so the Highs and Lows would be calculated based on the hours from 0400-2000. And the Closing Value would be the price at 2000. I've checked this manually and using these hours seems to work.

The script included below is accurate (it includes R5 and S5), but only uses data during normal trading hours (be sure to change the aggregation period to "day" and the length to "1").

I've tried (and failed) to modify the script so that the Highs and Lows are calculated using data from 0400-2000, and the closing price is at 2000. Can anyone help?

If we can modify this script to include these hours, I believe it will reflect the same values used by Thor and other BBT moderators who use DAS.


input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 25;
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 = if start then Highest(high(period = aggregationPeriod), length)[1] else if highValue[1] != 0 then highValue[1] else Double.NaN;
def lowValue = if start then Lowest(low(period = aggregationPeriod), length)[1] else if lowValue[1] != 0 then lowValue[1] else Double.NaN;
def closeValue = if start then close(period = aggregationPeriod)[1] else closeValue[1];
def range = highValue - lowValue;

def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot HH;
plot PP;
plot LL;

HH = PH;
LL = PL;
PP = (PH + PL + PC) / 3;

HH.SetStyle(Curve.MEDIUM_DASH);
LL.SetStyle(Curve.MEDIUM_DASH);

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(6));
R5.SetDefaultColor(GetColor(6));
R4.SetDefaultColor(GetColor(6));
R3.SetDefaultColor(GetColor(6));
R2.SetDefaultColor(GetColor(6));
R1.SetDefaultColor(GetColor(6));
S1.SetDefaultColor(GetColor(5));
S2.SetDefaultColor(GetColor(5));
S3.SetDefaultColor(GetColor(5));
S4.SetDefaultColor(GetColor(5));
S5.SetDefaultColor(GetColor(5));
S6.SetDefaultColor(GetColor(5));

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.GREEN,   if close[n1] > R6[n1] then no else yes);
AddChartBubble(StartPlot, R5[n1], "R5 " + (if showpricebubble then AsText(R5[n1]) else ""), Color.GREEN,   if close[n1] > R5[n1] then no else yes);
AddChartBubble(StartPlot, R4[n1], "R4 " + (if showpricebubble then AsText(R4[n1]) else ""), Color.GREEN,   if close[n1] > R4[n1] then no else yes);
AddChartBubble(StartPlot, R3[n1], "R3 " + (if showpricebubble then AsText(R3[n1]) else ""), Color.GREEN,   if close[n1] > R3[n1] then no else yes);
AddChartBubble(StartPlot, R2[n1], "R2 " + (if showpricebubble then AsText(R2[n1]) else ""), Color.GREEN,   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.GREEN,   if close[n1] > R1[n1] then no else yes);

AddChartBubble(StartPlot, S6[n1], "S6 " + (if showpricebubble then AsText(S6[n1]) else ""), Color.RED, if close[n1] > S6[n1] then no else yes);
AddChartBubble(StartPlot, S5[n1], "S5 " + (if showpricebubble then AsText(S5[n1]) else ""), Color.RED, if close[n1] > S5[n1] then no else yes);
AddChartBubble(StartPlot, S4[n1], "S4 " + (if showpricebubble then AsText(S4[n1]) else ""), Color.RED, if close[n1] > S4[n1] then no else yes);
AddChartBubble(StartPlot, S3[n1], "S3 " + (if showpricebubble then AsText(S3[n1]) else ""), Color.RED, if close[n1] > S3[n1] then no else yes);
AddChartBubble(StartPlot, S2[n1], "S2 " + (if showpricebubble then AsText(S2[n1]) else ""), Color.RED, 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.RED, 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();

 

Share this post


Link to post
Share on other sites
Bouj

I'm having such an issue getting the settings to be accurate. In addition to that, if I zoom in, or out of the chart, it is changing the placement of the pivot points. I have no idea what is accurate and what isn't. Has anyone found a solution?

Share this post


Link to post
Share on other sites
Miah

I made a DAS script specifically for Thor's CAMs here

Edited by Miah

Share this post


Link to post
Share on other sites

[[Template core/front/global/mobileNavigation is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.