Current Price Bubble on Chart

I am looking for a chart bubble that would be placed above the current candle that shows the current stock price. If possible, could someone assist?
 
The bubble is added with command:
AddChartBubble( buyCondition, low, "Buy", Color.GREEN, no);

Is it possible to remove staled (old) bubble from previous bar. So only the last bubble being shown on the chart?

On a different note, is it possible to have the chart bubble show up only one time.
 
Hi MerryD, thanks for the response. Just got to try your suggestion but it didn't works. All the previous bubbles are still on the chart. I'm looking for a way to only show the last bubble ONLY to make the chart less busy. In another word, I like to remove all the old bubbles and repaint on the the latest bubble.
 
Hi MerryD, thanks for the response. Just got to try your suggestion but it didn't works. All the previous bubbles are still on the chart. I'm looking for a way to only show the last bubble ONLY to make the chart less busy. In another word, I like to remove all the old bubbles and repaint on the the latest bubble.
this is the syntax that I tried:
addchartBubble(isnan(close[-1] and sell), text = close, "price location" = HIGH, color = Color.ORANGE);
 
this is the syntax that I tried:
addchartBubble(isnan(close[-1] and sell), text = close, "price location" = HIGH, color = Color.ORANGE);
You are misplacing a parentheses. I presume your code has sell defined

Ruby:
addchartBubble(isnan(close[-1]) and sell, text = close, "price location" = HIGH, color = Color.ORANGE);
 
Thanks Ruby. It's kinda work. Only the last bubble is displayed however currently it get remove on the next bar. Ideally, I like to see the last bubble to keep on displaying and get remove and replace by the latest bubble.
 
Thanks Ruby. It's kinda work. Only the last bubble is displayed however currently it get remove on the next bar. Ideally, I like to see the last bubble to keep on displaying and get remove and replace by the latest bubble.
As I mentioned, I do not know what your definition of 'sell' is. So remove it from your code and you will see the bubble move as price moves frim candle to candle.
 
@ProfessorAR15

Ruby:
addchartBubble(isnan(close[-1]), text = close, "price location" = HIGH, color = Color.ORANGE);
Is there a way to make the text display 2 different numbers, such as the close+1 and the close-1, at the same time? I'm trying to get the bubble to show a range of prices but I can't get the text function to output more than one thing.

edit: I'm able to do it using \n but it splits into 2 lines, so I'm wondering if it's possible to do it all in one line.
 
Last edited:
Is there a way to make the text display 2 different numbers, such as the close+1 and the close-1, at the same time? I'm trying to get the bubble to show a range of prices but I can't get the text function to output more than one thing.

edit: I'm able to do it using \n but it splits into 2 lines, so I'm wondering if it's possible to do it all in one line.

Try this

Code:
addchartBubble(isnan(close[-1]), high, (close+1) + " " + (close-1), Color.ORANGE);
 
Try this

Code:
addchartBubble(isnan(close[-1]), high, (close+1) + " " + (close-1), Color.ORANGE);
Thank you, that works. I thought I tried something like that but I must have had the wrong format or something. I was able to add some brackets to the side and it's displaying perfectly. Thanks again!
 
I tried some of the current price line codes, but none of them reflect the price at the heading area at the top of the chart. Is there a way to match that on the chart which may be for different chart times for the bars.?

Thanks for your effort. However, it still does not reflect the live price that is at the heading of the chart next to the the ticker symbol. The bubble on the chart shows different price. It seems no matter what I try and others provide there is no way to get the current live price on the chart.
 
Just tried the fist bubble example, got $6 difference in price for TELSA 5 min chart, $918 vs $912.

Without an image of showing such a diff and your settings, I can only confiirm that what I posted works for me.

Capture.jpg

Just tried the fist bubble example, got $6 difference in price for TELSA 5 min chart, $918 vs $912.
Also, make sure you are getting a 'realtime' feed. Here is a copy of the chart from the upper left corner showing my data feed.

 
My apologies, the code is Correct. I am using the TOS Paper Money charts to practice trading. When I switched to the Live Trading charts the bubble shows the correct live price.
Thank you SleepyZ for your efforts in trying to correct my error.
 
@ProfessorAR15

Ruby:
addchartBubble(isnan(close[-1]), text = close, "price location" = HIGH, color = Color.ORANGE);
Can the script be changed to show the current price of a different instrument on the same chart?
Example, If your looking at SPY but want the bubble to show the last price of a specific option or maybe the /ES
 
Can the script be changed to show the current price of a different instrument on the same chart?
Example, If your looking at SPY but want the bubble to show the last price of a specific option or maybe the /ES
[Edit code to make additional symbols other than current as inputs rather than def codes.]

The bubble in the upper chart has the close for the current chart symbol and 2 others.

The closes are stacked within the bubble by using the "\n" code.
The getsymbol() will display the current chart symbol name.
The bubblemover will move the bubble in the expansion area by the number of bars input at bubblemover.
The other 2 charts are just for testing the accuracy of the bubble in the upper chart.

Screenshot 2023-10-25 125248.png

Code:
input symbol1 = "/ES";
input symbol2 = "/YM";

input bubble = yes;
input bubblemover = 2;
def b = bubblemover;
def b1 = b + 1;

AddChartBubble(bubble and IsNaN(close[b]) and !IsNaN(close[b1]),  high[b1],
GetSymbol() + ": " + close[b1] +
"\n" + symbol1 + " : " + close(symbol1)[b1] +
"\n" + symbol2 + " : " + close(symbol2)[b1],
Color.ORANGE);

#
 
Last edited:

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