Need help setting default colors for custom watchlist column

rsdalntx

New member
Hello,

I'm creating some custom columns for my watchlists and I want to get the colors to match the green/red from default watchlist colors. I've tried:

color - Green/Red, LightGreen/LightRed,

getcolor(5) (for green) and getcolor(6) for red but none of them match

Does anyone know what colors to use or have custom color values for matching colors?

Below is an image of the watchlist with new columns and "last" column with default colors I'm trying to match.

1LhYWhl.jpg
 
Last edited:
Its a bit difficult because they are so anti-aliased, I don't really know which pixel to grab.

VOpqSpF.png



Uu2ox4Z.png


pECU33d.png
Thanks for the help. I was thinking there would be some color code I could use. Like you said doing a screen grab is a little sketchy. Maybe I can just brute force all the color codes and see if I get lucky :rolleyes:
 
Thanks for the help. I was thinking there would be some color code I could use. Like you said doing a screen grab is a little sketchy. Maybe I can just brute force all the color codes and see if I get lucky :rolleyes:
? you don't need to guess.
joshua showed you RGB color numbers to try


here is a sample code to draw colored shading on the chart, using RGB color numbers
you can use a global color in many places.

i came up with 33,140,33 as being close for the green font, but as joshua said, zooming into a few pixels, doesn't result in a definite color.

Code:
# rgb_color_numbers_0

def hiline = high * 1.1;
def loline = high * 1.01;

input color_number_0to255 = yes; #hint color_number_0to255: "a dummy variable, to explain the number range"

input shade_color_red_num = 33;
def cred = shade_color_red_num;

input shade_color_green_num = 140;
def cgrn = shade_color_green_num;

input shade_color_blue_num = 33;
def cblu = shade_color_blue_num;

# green font
DefineGlobalColor( "shade1" , CreateColor(cred,cgrn,cblu));

addcloud(hiline,loline, GlobalColor( "shade1" ), GlobalColor( "shade1" ) );
#
hal_color
 
Last edited:
I am trying to set up custom columns with shades of green depending on magnitude of column value. As a simple example, if the column is price change%, i would like to assign different shades of green for 0-1%, 1-5%, 5-10%, etc.

Can someone help me with how to switch out the Color.GREEN to a Shadeg1 i created as globalColor in the code below?

DefineGlobalColor( "Shadeg1" , CreateColor(51,192,0));
AssignBackgroundColor(if z < -0 then Color.RED else if z > 0 then Color.GREEN else Color.GRAY);

Obviously i will add more conditions for the 1-5% and 5-10%.


Alternatively, if there is a way to add opacity value, that would work for me.
 
Last edited by a moderator:
The ToS platform does not provide for the use of the DefineGlobalColor() function in watchlist scripts.
However, you can use the CreateColor() function:
Ruby:
AssignBackgroundColor(
    if z < -0 then Color.RED else
    if z > 0.5 then CreateColor(51,192,0) else
    if z > 0 then Color.GREEN else Color.GRAY);
 
I am trying to set up custom columns with shades of green depending on magnitude of column value. As a simple example, if the column is price change%, i would like to assign different shades of green for 0-1%, 1-5%, 5-10%, etc.

Can someone help me with how to switch out the Color.GREEN to a Shadeg1 i created as globalColor in the code below?

DefineGlobalColor( "Shadeg1" , CreateColor(51,192,0));
AssignBackgroundColor(if z < -0 then Color.RED else if z > 0 then Color.GREEN else Color.GRAY);

Obviously i will add more conditions for the 1-5% and 5-10%.


Alternatively, if there is a way to add opacity value, that would work for me.

here is a rough code/idea to get you started...

RGB color,
red, green, blue
CreateColor(0, 255, 0));

try changing the middle number for different shades of green

untested

Code:
#  range , is a number 1 to 4, coresponding to your % ranges.
#def range = ....

def chg = 100 * (close - close[1])/ close[1];

# calc price % chg
def range = if chg < 1 then 1 else if chg < 5 then 2 else if chg < 10 then 3 else if chg < 20 then 4 else 5;

input color_skip = 20;
def grn;
if range == 1 then (255 - ( color_skip * 0))
else if range == 2 then (255 - ( color_skip * 1))
else if range == 3 then (255 - ( color_skip * 2))
else if range == 4 then (255 - ( color_skip * 3))
else 50;

# use this somehow to color what you want
AssignBackgroundColor(CreateColor(0, grn, 0));
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
441 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