# Simple Color Change on Watchlist for value Above "X"

#### Luke91-DT

##### New member
Hey everyone,

I'm looking for something pretty simple, I am pretty inexperienced to writing script for ThinkScript. I am using a simple script for showing volume spikes on my WL tickers, what I'd like to be able to do is have it turn the background color green if it is above X value (5 or 10 for example). Below is the script and a screen shot of how it presents on my watchlist currently.

Any help is appreciated, thanks!

(volume / Average(volume, 20))

Solution
I'm looking for something pretty simple, I am pretty inexperienced to writing script for ThinkScript. I am using a simple script for showing volume spikes on my WL tickers, what I'd like to be able to do is have it turn the background color green if it is above X value (5 or 10 for example). Below is the script and a screen shot of how it presents on my watchlist currently.

this is a column study.
it has 4 number levels to compare to, so there are 5 color ranges.
the levels are set to, 2,4,6,8
lower numbers are dark colors.
higher numbers are lighter. above 8 will be green.

column study , 1 minute
zvolrng1 , http://tos.mx/Rhjxbj2

Ruby:
``````# zvolrng1

# r = (volume / Average(volume, 20))

def v = volume;
def len = 20;
def...``````
I'm looking for something pretty simple, I am pretty inexperienced to writing script for ThinkScript. I am using a simple script for showing volume spikes on my WL tickers, what I'd like to be able to do is have it turn the background color green if it is above X value (5 or 10 for example). Below is the script and a screen shot of how it presents on my watchlist currently.

this is a column study.
it has 4 number levels to compare to, so there are 5 color ranges.
the levels are set to, 2,4,6,8
lower numbers are dark colors.
higher numbers are lighter. above 8 will be green.

column study , 1 minute
zvolrng1 , http://tos.mx/Rhjxbj2

Ruby:
``````# zvolrng1

# r = (volume / Average(volume, 20))

def v = volume;
def len = 20;
def vavg = average(v, len);
def r = round(v/vavg,2);

plot z = r;
# font color
z.setdefaultcolor(color.black);
#z.setdefaultcolor(color.white);

def level1 = 2;
def level2 = 4;
def level3 = 6;
def level4 = 8;

assignbackgroundcolor(
if r < level1 then color.dark_gray
else if ( r >= level1 and r < level2) then color.gray
else if ( r >= level2 and r < level3) then color.magenta
else if ( r >= level3 and r < level4) then color.yellow
else color.green);``````

this is a column study.
it has 4 number levels to compare to, so there are 5 color ranges.
the levels are set to, 2,4,6,8
lower numbers are dark colors.
higher numbers are lighter. above 8 will be green.

column study , 1 minute
zvolrng1 , http://tos.mx/Rhjxbj2

Ruby:
``````# zvolrng1

# r = (volume / Average(volume, 20))

def v = volume;
def len = 20;
def vavg = average(v, len);
def r = round(v/vavg,2);

plot z = r;
# font color
z.setdefaultcolor(color.black);
#z.setdefaultcolor(color.white);

def level1 = 2;
def level2 = 4;
def level3 = 6;
def level4 = 8;

assignbackgroundcolor(
if r < level1 then color.dark_gray
else if ( r >= level1 and r < level2) then color.gray
else if ( r >= level2 and r < level3) then color.magenta
else if ( r >= level3 and r < level4) then color.yellow
else color.green);``````
Thanks a ton! I'll be able to learn from this as well.

Easy to adjust and might help with my future scripts!

87k+ Posts
403 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?