Adding price labels

MikelL

New member
I have this plotting lines

is there a way i can plot the price value of the line?
like if P32 is plotting a line at 3256.5 can i add a label that floats on the line saying 3256.5?

input sPeriod = AggregationPeriod.THIRTY_MIN;
input F32 = {default “yes”, “no”};
input F40 = {default “yes”, “no”};
input length = 14;
input averageType = AverageType.WEIGHTED;

def ATR = MovingAverage(averageType, TrueRange(high(period = sPeriod), close(period = sPeriod), low(period = sPeriod)), length);

def TWEN = ATR[1] * .32;
def TH1 = ATR[1] * .40;

def U32 = close(period = sPeriod)[1] + TWEN;
def U40 = close(period = sPeriod)[1] + TH1;


plot P32 = if !F32 then U32 else Double.NaN;
plot P40 = if !F40 then U40 else Double.NaN;
 

Pensar

Well-known member
VIP
Lifetime
@MikelL Try adding this to the bottom of your code, see if it is what you are looking for.

Code:
input show_bubbles = yes;
def current = !isnan(close) and isnan(close[-1]);
AddChartBubble(show_bubbles and current, P32, Round(P32), color.dark_orange, no);
AddChartBubble(show_bubbles and current, P40, Round(P40), color.light_green, yes);
 
Last edited:

jrob0124

New member
Hello,

Is it possible to show the price on a plotted line and not the bubble? For example, when using the price line drawing the price can be displayed on the left or the right of the line and is not used in a bubble, which looks very clean and easy to read. Can I do the same when I am using the plot function or another function?

plot Sup01 = Support01;Sup01.SetDefaultColor(Color.GRAY);Sup01.setStyle(Curve.LONG_DASH);Sup01.HideBubble()
 

Pensar

Well-known member
VIP
Lifetime
@jrob0124 As far as I know, plotting just the numerical value of a line is not possible without a bubble, perhaps someone with more experience can provide a better answer :). I did notice that in the sample of code you posted, there is HideBubble(). If you delete that line, you should see the current (most recent) value of the plot on the right/left axis (whichever you have it set to display on).

You can certainly move price bubbles to the far left of a chart; but I'm not certain what or where you're trying to plot. To move bubbles around, here is an sample from code I recently put together, it plots 50 bars back from the current bar.

Code:
def x = !isnan(close[-50]) and isnan(close[-51]);

There are many more ways to anchor bubbles on a chart, here is an excerpt from a ORB code by Mobius.

Code:
def bar = BarNumber();
def BubbleX = bar == HighestAll(bar);
AddChartBubble(BubbleX, RTHo, "RTH", Color.GRAY, 0);

And, here's a third way to anchor a bubble, this is from Mobius' Floor Trader Pivots study.

Code:
def Yesterday = GetDay() == GetLastDay() - 1;
def BubbleLocation = !yesterday and yesterday[1];
AddChartBubble(BubbleLocation, prevHigh, "Prev High", Color.DARK_GRAY, no);
 

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.
Top