Chart Bubble Transparency


Category:
0
0

Hello again.   I have made a cool chart study that uses the Assign color Feature and am practicing setting up sound alerts as well as chart bubbles.     Ive assigned color to wicking candles that cross SMA and VWAP.   Thing is theres so many bubbles! Though when Im zoomed in on an intraday chart its not so bad, but the bubbles hang off to the right, sometimes covering the next candle.  I wish that I knew a way to make them a bit ( A lot..)  more see though. Heres my clustered screen shot.

I know how to make chart color more transparent in the Select Color menu.  Having trouble finding a solution to adding this to my think script, which Ive pasted below.    Hoping theres a way

—–

addchartbubble (Hammer_Long, low, “Long”, createColor(79,163,154), yes);

addChartBubble (Hammer_Short, high, “Short”, createcolor(223,94,86), no);

addchartBubble (VwAP_LONG , low, “Long”, createcolor(0,194,255), yes);

addchartBubble (Vwap_SHORT, high, “Short”, Createcolor(255,102,225), no);

Attachments:
RESOLVED
Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on June 17, 2020 10:04 pm
2520 views
0
Pete, is there a way to set the transparency 100% but with white text, just like in preview top line? tks for all your super helpful tips
( at July 19, 2020 11:24 am)
0

We cannot change the color of the text in chart bubbles. Otherwise that is a really excellent idea. But it does work for anyone using a white or light colored background for their charts!

( at July 19, 2020 1:25 pm)
0
Private answer

You did not provide a fully functional section of code so this solution cannot provide a direct solution to your request. However I was curious about your request and decided to do a bit of research. I learned something new, so thank you for that. I love to learn new things, which is one of the reasons I enjoy teaching. So what did I learn?

how to make chart color more transparent in the Select Color menu

I have been asked if it were possible to adjust the transparency of chart elements such as chart labels, plots and chart bubbles in the past. But I was not aware that color transparency could be manually adjusted through user settings. So excited to learn about this, really cool.

I can confirm that we cannot set transparency directly within our code. Thinkorswim provides only one method for creating custom colors and it uses only the RGB values and lacks the Alpha input which sets transparency. Details here:

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

Perhaps someday this will be added. Until then, we do have a couple of ways to work around this. In the code below I create a test study that plots chart bubbles and sets the color using the DefineGlobalColor() function. Details here:

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

Here is the code to build the test study:

DefineGlobalColor("test", Color.GREEN);
AddChartBubble(close > close[1], high, "Text", GlobalColor("test"));

First screenshot below shows how to access the color pallet from user settings which is created by the DefineGlobalColor() function. Second screenshot shows where to go to adjust transparency and the final screenshot shows the comparison with the transparency applied to the right side chart.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on June 18, 2020 8:09 am
0
Thats it! I just knew there must be a way to access the Color menu. (Did not know of ’Globals’, will keep learning) So I added a global color for each of the bubbles I have showing up on my charts. Adjusted the colors a bit. So glad this is possible. I will definitely be using this for other studies! Thank You so much again DefineGlobalColor(”test 1”, Color.GREEN); DefineGlobalColor(”test 2”, Color.GREEN); DefineGlobalColor(”test 3”, Color.GREEN); DefineGlobalColor(”test 4”, Color.GREEN); addchartbubble (Hammer_Long, low, ”L”, GlobalColor(”test 1”), yes); addChartBubble (Hammer_Short, high, ”S”, GlobalColor(”test 2”), no); addchartBubble (VwAP_LONG , low, ”L”, GlobalColor(”test 3”), yes); addchartBubble (Vwap_SHORT, high, ”S”, GlobalColor(”test 4”), no);
( at June 18, 2020 10:49 am)