Hide plot show bubble

solidago

New member
I am attempting to add a function to a thinkscript in which I can hide plots yet maintain the bubble that they print on the chart axis and hitting a wall; any help would be appreciated. As an example to work off of, here is TOS native "DailyHighLow". If attempting to use the SetHiding function on a plot, it will hide the chart bubble as well.

#
# TD Ameritrade IP Company, Inc. (c) 2011-2023
#

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;

plot DailyHigh;
plot DailyLow;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyHigh = Double.NaN;
DailyLow = Double.NaN;
} else {
DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
}

DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 

Attachments

  • script example.JPG
    script example.JPG
    50.4 KB · Views: 81
I am attempting to add a function to a thinkscript in which I can hide plots yet maintain the bubble that they print on the chart axis and hitting a wall; any help would be appreciated. As an example to work off of, here is TOS native "DailyHighLow". If attempting to use the SetHiding function on a plot, it will hide the chart bubble as well.

#
# TD Ameritrade IP Company, Inc. (c) 2011-2023
#

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;

plot DailyHigh;
plot DailyLow;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyHigh = Double.NaN;
DailyLow = Double.NaN;
} else {
DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
}

DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Regrettably, once you hide the plot, the TOS right axis bubble will disappear. However, you can create your own bubble adjacent to the right axis in the expansion that might work for you.

Here is the code added to the script to do this:

Code:
input hideplot = yes;
input bubble   = yes;
DailyHigh.SetHiding(hideplot);
AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), DailyHigh, DailyHigh, DailyHigh.TakeValueColor());
DailyLow.SetHiding(hideplot);
AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), DailyLow, DailyLow, DailyLow.TakeValueColor(), no);

Screenshot 2023-12-24 221203.png
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2011-2023
#

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;

plot DailyHigh;
plot DailyLow;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
    DailyHigh = Double.NaN;
    DailyLow = Double.NaN;
} else {
    DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
    DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
}

input hideplot = yes;
input bubble   = yes;
DailyHigh.SetHiding(hideplot);
AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), DailyHigh, DailyHigh, DailyHigh.TakeValueColor());
DailyLow.SetHiding(hideplot);
AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), DailyLow, DailyLow, DailyLow.TakeValueColor(), no);

DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

#
 

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

I am attempting to add a function to a thinkscript in which I can hide plots yet maintain the bubble that they print on the chart axis and hitting a wall; any help would be appreciated. As an example to work off of, here is TOS native "DailyHighLow". If attempting to use the SetHiding function on a plot, it will hide the chart bubble as well.

#
# TD Ameritrade IP Company, Inc. (c) 2011-2023
#

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;

plot DailyHigh;
plot DailyLow;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
DailyHigh = Double.NaN;
DailyLow = Double.NaN;
} else {
DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
}

DailyHigh.SetDefaultColor(GetColor(4));
DailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
DailyLow.SetDefaultColor(GetColor(4));
DailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);


here is another way, plot something small, that generates the bubble.
i used a point, at the highest / lowest prices, on last day.


Code:
# noplot_bubble

#https://usethinkscript.com/threads/hide-plot-show-bubble.17416/#post-135880
#Hide plot show bubble

def na = Double.NaN;
def currentday = (getday() == getlastday());

# DailyHighLow
# TD Ameritrade IP Company, Inc. (c) 2011-2023
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
#input displace = -1;
input showOnlyLastPeriod = no;

# data
#def DailyHigh = Highest(high(period = aggregationPeriod)[-displace], length);
#def DailyLow = Lowest(low(period = aggregationPeriod)[-displace], length);
def DailyHigh = Highest(high(period = aggregationPeriod)[0], length);
def DailyLow = Lowest(low(period = aggregationPeriod)[0], length);

# plot lines
plot zDailyHigh;
plot zDailyLow;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
    zDailyHigh = Double.NaN;
    zDailyLow = Double.NaN;
} else {
    zDailyHigh = DailyHigh;
    zDailyLow = Dailylow;
}

input hideplot = yes;
input bubble   = no;
zDailyHigh.SetHiding(hideplot);
zDailyLow.SetHiding(hideplot);
zDailyHigh.SetDefaultColor(GetColor(4));
zDailyHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
zDailyLow.SetDefaultColor(GetColor(4));
zDailyLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

def hix = if isnan(close) then hix[1] else dailyhigh;
def lox = if isnan(close) then lox[1] else dailylow;

#AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), zDailyHigh[0], zDailyHigh[0], zDailyHigh.TakeValueColor(),yes);
#AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), DailyLow[0], DailyLow[0], zDailyLow.TakeValueColor(), no);
AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), hix, hix, zDailyHigh.TakeValueColor(),yes);
AddChartBubble(bubble and BarNumber() == HighestAll(BarNumber()), lox, lox, zDailyLow.TakeValueColor(), no);


# plot a dot, to cause price bubble to appear
plot zhibub = if hideplot and currentday and high == dailyhigh then high else na;
plot zlobub = if hideplot and currentday and low == dailylow then low else na;
zhibub.SetPaintingStrategy(PaintingStrategy.points);
zhibub.SetDefaultColor(Color.yellow);
zhibub.setlineweight(1);
#zhibub.hidebubble();
zlobub.SetPaintingStrategy(PaintingStrategy.points);
zlobub.SetDefaultColor(Color.yellow);
zlobub.setlineweight(1);
#

loGQ4BR.jpg
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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