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))

bu56H3B.png
 
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);
 
Solution

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

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!
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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