Chart Bubble for Horizontal Line


Category:
0
0

So I have some code that does exactly what I want (paints two horizontal lines on the chart with the previous day’s high and low), but… I would love to be able to add a bubble underneath each with text like ‘PD High’ or ‘PD Low’.

I think this is possible, based on other common studies like Fibonacci. However, I cannot quite figure out the AddChartBubble syntax.

I’d just want the bubbles to be at the left side of the chart (at today’s open).

Any thoughts Mr. Hahn?

(code attached)

 

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 6)
Asked on March 10, 2021 6:26 pm
1036 views
1
Private answer

The full set of specifications for using the AddChartBubble() statement is found here:

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

Add the following two lines of code to display the two chart bubbles you have requested:

AddChartBubble(DailyHigh <> DailyHigh[1], DailyHigh, "PD High", Color.GREEN);
AddChartBubble(DailyLow <> DailyLow[1], DailyLow, "PD Low", Color.RED);

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on March 10, 2021 7:22 pm
0
That worked perfectly. Thank you. Quick follow up if allowed... What is that first section of the code "doing", comparing previous vs current?
( at March 10, 2021 7:36 pm)
0
Those two plots "DailyHigh" and "DailyLow" change at the start of each day and remain the same for the duration of each day. Using the less than and greater than signs like this is the same as saying "NOT Equal". Using the index value on the second item causes it to look at the previous bar. In plain English it says, true on each candle in which the current value of "DailyHigh" is not equal to the previous value of "DailyHigh".
( at March 10, 2021 9:25 pm)