Change color of label in thinkscript?

zeek

Active member
2019 Donor
So i have a study which has chart labels but there is no color code when i checked the source. Can anyone help me show what i need to add to the line of code so that i can change the color myself to whatever i want?

This is the line,

AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2));
 

mc01439

Well-known member
2019 Donor
VIP
So i have a study which has chart labels but there is no color code when i checked the source. Can anyone help me show what i need to add to the line of code so that i can change the color myself to whatever i want?

This is the line,
What are you trying to show? Are you looking for one color or multi color?

This is one color.

AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2), color.CYAN);
 

zeek

Active member
2019 Donor
What are you trying to show? Are you looking for one color or multi color?

This is one color.

AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2), color.CYAN);

I just want the ability to change the color myself using these codes here

Edit: Ok, thanks. I will try and add just like you did in your example.
 

tomsk

Well-known member
VIP
@zeek Here is an example on how to have different colors in your label depending on the value of level1

Code:
AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2),
    if level1 > 80 then Color.Green else if level1 < 40 then Color.Red else Color.Yellow);

You can replace the color with RGB definitions as found in the link you posted, so instead of Color.Green you would have
CreateColor(50,150,250) as an example
 

Robby Luca

New member
I would like to add some color to my labels but I have been unable to do so. Here's the code;

Code:
AddLabel(yes, if Price > YestHigh then "Above" else if Price < YestLow then "Below" else "Inside");

I would like to make "Above" Color.UPTICK, "Below" Color.UPTICK, and "Inside" Color.RED.
Thanks for the help!
 

Similar threads

Top