Camarilla Pivot Points for ThinkOrSwim

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!
Hi, after I loaded this script to my TOS platform I see it working but not showing lines on Mondays, this is strange but it does not draw lines on Mondays. Is it something in my settings that I need to change?
 
Hi, after I loaded this script to my TOS platform I see it working but not showing lines on Mondays, this is strange but it does not draw lines on Mondays. Is it something in my settings that I need to change?
that's due to the holiday... but if you want me to show you every day in the afternoon I'll give you one that I have...
 
Code:
# Camarilla Pivot Range
# Assembled using useThinkScript.com

input showonlyLastPeriod = yes;
input show_bubbles       = yes;#Hint show_bubbles: turns all bubbles on or off    
input show_bubble_price  = yes;#Hint show_bubble_price: displays price in bubble

input aggregationPeriod = AggregationPeriod.DAY;
def dayCount = CompoundValue(1, if GetYYYYMMDD() != GetYYYYMMDD()[1] then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;
def HIGHprev = high(period = aggregationPeriod)[1];
def LOWprev = low(period = aggregationPeriod)[1];
def CLOSEprev = close(period = aggregationPeriod)[1];
def range = HIGHprev - LOWprev;

plot PP = if showonlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-2])
          then Double.NaN
          else (HIGHprev + LOWprev + CLOSEprev) / 3;
plot R5 = (HIGHprev / LOWprev) * CLOSEprev;
plot R4 = CLOSEprev + range * (1.1) / 2;
plot R3 = CLOSEprev + range * (1.1) / 4;
plot R2 = CLOSEprev + range * (1.1) / 6;
plot R1 = CLOSEprev + range * (1.1) / 12;
plot S1 = CLOSEprev - range * (1.1) / 12;
plot S2 = CLOSEprev - range * (1.1) / 6;
plot S3 = CLOSEprev - range * (1.1) / 4;
plot S4 = CLOSEprev - range * (1.1) / 2;
plot S5 = (CLOSEprev - (R5 - CLOSEprev));

R1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
R5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
S5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else R5 != R5[1],
                R5,
                "R5: " + if !show_bubble_price then ""
                       else AsText(Round(R5 / TickSize(), 0) * TickSize()), Color. WHITE);
AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else R4 != R4[1],
                R4,
                "R4: " + if !show_bubble_price then ""
                       else AsText(Round(R4 / TickSize(), 0) * TickSize()), Color. WHITE);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else R3 != R3[1],
                R3,
                "R3: " + if !show_bubble_price then ""
                       else AsText(Round(R3 / TickSize(), 0) * TickSize()), Color. WHITE);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else R2 != R2[1],
                R2,
                "R2: " + if !show_bubble_price then ""
                       else AsText(Round(R2 / TickSize(), 0) * TickSize()), Color. WHITE);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else R1 != R1[1],
                R1,
                "R1: " + if !show_bubble_price then ""
                       else AsText(Round(R1 / TickSize(), 0) * TickSize()), Color. WHITE);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else PP != PP[1],
                PP,
                "PP: " + if !show_bubble_price then ""
                       else AsText(Round(PP / TickSize(), 0) * TickSize()), Color.WHITE);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else S5 != S5[1],
                S5,
                "S5: " + if !show_bubble_price then ""
                       else AsText(Round(S5 / TickSize(), 0) * TickSize()), Color.WHITE, no);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else S4 != S4[1],
                S4,
                "S4: " + if !show_bubble_price then ""
                       else AsText(Round(S4 / TickSize(), 0) * TickSize()), Color.WHITE, no);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else S3 != S3[1],
                S3,
                "S3: " + if !show_bubble_price then ""
                       else AsText(Round(S3 / TickSize(), 0) * TickSize()), Color.WHITE, no);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else S2 != S2[1],
                S2,
                "S2: " + if !show_bubble_price then ""
                       else AsText(Round(S2 / TickSize(), 0) * TickSize()), Color.WHITE, no);

AddChartBubble( show_bubbles and
                if showonlyLastPeriod
                then thisDay[1] == 1 and thisDay == 0
                else S1 != S1[1],
                S1,
                "S1: " + if !show_bubble_price then ""
                       else AsText(Round(S1 / TickSize(), 0) * TickSize()), Color.WHITE, no);

Hi guys, how do I create an option to only show the number of instances I want it to appear,
e.g. Number of pivots back, and If I want it to project the next month's pivot?

I am unable to insert image, could anyone help to look through the code please.
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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