Make Label Color Lighter More Translucent

niner35

New member
Below is an add label that shows RVol in a chart i use. It is helpful but often covers up important information.
I saw posts here about Show and Global Color that can make a label with lighter or more translucent/transparent color.
I tried but could not get it to work. I cant do much more than cut and paste.
Could someone add the needed code to it? It would be greatly appreciated.
I am first time poster here. Was not sure if to append to related threads. Since they were old i posted new.

Many thanks.

input offset = 1;
input length = 21;

def ADV = Average(volume, length)[offset];
def rVol = volume / ADV;

#DefineGlobalColor("", Color.CURRENT);
AddLabel(yes, " RVOL: " + Round(rVol, 2), if rVol > 10 then Color.VIOLET else if rVol > 8 then Color.DARK_GREEN else if rVol > 6 then Color.GREEN else if rVol > 4 then Color.LIGHT_GREEN else if rVol > 2 then Color.LIME else if rVol > 1 then Color.PINK else if rVol < 1 then Color.BLACK else Color.BLACK);
 
Solution
Below is an add label that shows RVol in a chart i use. It is helpful but often covers up important information.
I saw posts here about Show and Global Color that can make a label with lighter or more translucent/transparent color.
I tried but could not get it to work. I cant do much more than cut and paste.
Could someone add the needed code to it? It would be greatly appreciated.
I am first time poster here. Was not sure if to append to related threads. Since they were old i posted new.

Many thanks.

input offset = 1;
input length = 21;

def ADV = Average(volume, length)[offset];
def rVol = volume / ADV;

#DefineGlobalColor("", Color.CURRENT);
AddLabel(yes, " RVOL: " +...
Below is an add label that shows RVol in a chart i use. It is helpful but often covers up important information.
I saw posts here about Show and Global Color that can make a label with lighter or more translucent/transparent color.
I tried but could not get it to work. I cant do much more than cut and paste.
Could someone add the needed code to it? It would be greatly appreciated.
I am first time poster here. Was not sure if to append to related threads. Since they were old i posted new.

Many thanks.

input offset = 1;
input length = 21;

def ADV = Average(volume, length)[offset];
def rVol = volume / ADV;

#DefineGlobalColor("", Color.CURRENT);
AddLabel(yes, " RVOL: " + Round(rVol, 2), if rVol > 10 then Color.VIOLET else if rVol > 8 then Color.DARK_GREEN else if rVol > 6 then Color.GREEN else if rVol > 4 then Color.LIGHT_GREEN else if rVol > 2 then Color.LIME else if rVol > 1 then Color.PINK else if rVol < 1 then Color.BLACK else Color.BLACK);

Global colors are the best way I'm sure. I've never gotten it to work correctly for me either. You can also use the create color option. ex. createcolor(250,100,100) that uses RGB coloring. The Highest number being the color preference and the other two numbers adding more or less "transparency". So 250,100,100 is going to be red with a certain transparency. 250,200,200 is going to be more muted/ transparent.
 
Solution

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

The fourth+ color parameters like transparency and alpha are not included in the color functions. The label's color needs to be connected to a color swatch in the script's input settings, and then the transparency must be adjusted manually.

Code:
plot DummyPlot = Double.NaN;
AddLabel(yes, " x x x x x x x x x x x x x x ", DummyPlot.TakeValueColor());

FWbYa1T.png


Un8pQEj.png


In your case, you're changing between many colors. So, yes, it would probably be best to expose them as globals. You would still need to manually adjust each of them.

Code:
defineGlobalColor("Green",CreateColor(0,255,0));
defineGlobalColor("Red",CreateColor(255,0,0));
#defineGlobalColor...

AddLabel(yes, "TEST",
    if Yes then globalcolor("Green")
    #else if...
    else globalColor("Red")
);
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
410 Online
Create Post

Similar threads

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