# High Low Bubble in Chart programatically

#### Ravenjams

##### New member
Hello,

I haven't found what I was looking for in searches... Maybe someone can point me to what I am looking for...

In TOS Chart setting you have an option to "Show high/low bubbles"

How can I get that data programmatically?

How does TOS calculate this so I can use it in my script?

I would add a graphic, but I am so new I haven't figured out how to do this yet.

Thank You!

Solution
Here is code to re-create the HiLo bubbles:

def h = HighestAll(high);
def l = LowestAll(low);
AddChartBubble(high == h, high, "Hi: " + h, Color.WHITE);
AddChartBubble(low == l, low, "Lo: " + l, Color.WHITE, no);
Here is code to re-create the HiLo bubbles:

def h = HighestAll(high);
def l = LowestAll(low);
AddChartBubble(high == h, high, "Hi: " + h, Color.WHITE);
AddChartBubble(low == l, low, "Lo: " + l, Color.WHITE, no);

Here is code to re-create the HiLo bubbles:
This is nice...can we have high low bubble just for previous day..so that we can see the breakout instead of having lines

This is nice...can we have high low bubble just for previous day..so that we can see the breakout instead of having lines

Here is a modification to a previous script I have done that allows you to choose the prior day's high/low based upon the input day. Currently day is defaulted to 1.

Ruby:
``````#Example_PreviousDaysHL-each_extended_through_expansion
#20170911 - BLT
#Example Highs/Lows from previous days, extended from each day through the right expansion

script philow {
input n = 1;
def ymd = GetYYYYMMDD();
def ok = !IsNaN(close);
def capture = ok and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture
then dayCount[1] + 1
else dayCount[1], 0);
def thisDay = (HighestAll(dayCount) - dayCount) ;
def hh = CompoundValue(1, if thisDay[1] == n + 1 and thisDay == n
then high
else if thisDay == n and  high > hh[1] and thisDay == n
then high
else hh[1] , high);
def hhnan = if IsNaN(close) then hhnan[1] else hh;
plot hhplot = if thisDay == n
then Double.NaN
else if thisDay <= n
then hhnan
else Double.NaN;

def ll = CompoundValue(1, if thisDay[1] == n + 1 and thisDay == n
then low
else if  thisDay == n and low < ll[1] and thisDay == n
then low
else ll[1] , low);
def llnan   = if IsNaN(ll) then llnan[1] else ll;
plot llplot = if thisDay == n and SecondsFromTime(0930) < 0
then Double.NaN
else if thisDay <= n
then (llnan)
else Double.NaN;

plot day = thisday;

}

#Plots of Highs/Lows/Opens/Closes based upon script...add more days using similar plot statements, increasing the value by 1

input show_lines = no;
input day = 1;
plot H1   = HighestAll(philow(day));
plot L1   = LowestAll(philow(day).llplot);

H1.SetHiding(!show_lines);
L1.SetHiding(!show_lines);

input show_bubbles = yes;
AddChartBubble(show_bubbles and philow().day == day and  high == H1, high, "HH: " + H1, Color.GREEN);
AddChartBubble(show_bubbles and philow().day == day and low == L1, low, "LL: " + L1, Color.LIGHT_RED, no);``````

Here is a modification to a previous script I have done that allows you to choose the prior day's high/low based upon the input day. Currently day is defaulted to 1.
Thank you sir! ...can we exclude extended hours...so that it will be only for market hours since I use extended hours enabled

87k+ Posts
240 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?