Camarilla Points names

TProCalcs

New member
Hello,
Using TOS standard CamarillaPoints script it does not show the individual line names R1, R2 etc. when they are plotted on the chart. How can I add code to show the actual line name?
 
Solution
Hello,
Using TOS standard CamarillaPoints script it does not show the individual line names R1, R2 etc. when they are plotted on the chart. How can I add code to show the actual line name?

This adds movable bubbles within the expansion area, as well as, an option to plot R1/SI lines/bubbles.

Screenshot 2024-01-25 095237.png
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2023
#

input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 25;
input hideR1_S1 = 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...
Hello,
Using TOS standard CamarillaPoints script it does not show the individual line names R1, R2 etc. when they are plotted on the chart. How can I add code to show the actual line name?

This adds movable bubbles within the expansion area, as well as, an option to plot R1/SI lines/bubbles.

Screenshot 2024-01-25 095237.png
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2023
#

input aggregationPeriod = {default "DAY", "WEEK", "MONTH"};
input length = 25;
input hideR1_S1 = 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;

plot R5 = (highValue / lowValue) * closeValue;
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;
plot S5 = (closeValue - (R5 - closeValue));

R1.SetHiding(hideR1_S1);
S1.SetHiding(hideR1_S1);

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

def paintingStrategy = if aggregationPeriod == aggregationPeriod.DAY then PaintingStrategy.POINTS else if aggregationPeriod == aggregationPeriod.WEEK then PaintingStrategy.TRIANGLES else PaintingStrategy.SQUARES;

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

input bubbles = yes;
input bubblemover = 2;
def   mover = bubbles and !IsNaN(close[bubblemover + 1]) and IsNaN(close[bubblemover]);
AddChartBubble(mover, R5, "R5", R5.TakeValueColor());
AddChartBubble(mover, R4, "R4", R4.TakeValueColor());
AddChartBubble(mover, R3, "R3", R3.TakeValueColor());
AddChartBubble(mover, R2, "R2", R2.TakeValueColor());
AddChartBubble(mover and hideR1_S1 == no, R1, "R1", R1.TakeValueColor());

AddChartBubble(mover, S5, "S5", S5.TakeValueColor());
AddChartBubble(mover, S4, "S4", S4.TakeValueColor());
AddChartBubble(mover, S3, "S3", S3.TakeValueColor());
AddChartBubble(mover, S2, "S2", S2.TakeValueColor());
AddChartBubble(mover and hideR1_S1 == no, S1, "S1", S1.TakeValueColor());

#
 
Solution

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
325 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