Add chart label displaying close at specified time


Category:
0
0

Hi Pete,

I am looking for a label either pointing to a specific time line or on the top of chart.

input targetTime = 1430;
def targetBar = SecondsFromTime(targetTime) == 0;
rec targetClose = if targetBar then close else targetClose[1];
plot data = targetClose;

Thank you,

Sam

RESOLVED
Marked as spam
Posted by (Questions: 49, Answers: 62)
Asked on September 21, 2019 11:12 pm
148 views
0
I am moving this post out of the "Frequently Asked Questions" topic and into the "Chart Studies" topic. I am also updating the title or your question to reflect the context. The title you chose lacks sufficient detail.
( at September 22, 2019 8:13 am)
0
Private answer

We do this using a function named AddChartBubble(). Full details here:

https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AddChartBubble.html

For your example, simply add the following line to the bottom of your existing code:

AddChartBubble(targetBar, targetClose, Concat("Close: ", targetClose), Color.GRAY, yes);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 22, 2019 8:18 am
0
Hi Pete, You meant to just add the following line as you mentioned then I did that but I am getting an error.
( at September 22, 2019 1:35 pm)
0
Sorry, I corrected the error in my answer. Try it again and it should work this time.
( at September 22, 2019 9:06 pm)
0
Perfect. Highly appreciated.
( at September 22, 2019 9:47 pm)