Watchlist Script reFormat

Tsw85

New member
Good Day UseThinkScript Community,

I have a Watchlist script pasted below that displays the % of the ask between yesterday's high & today's low. I'm hoping someone can help me with a couple simple format changes to the code:

1.) Display the number as a percentage with zero decimal places
2.) Display the number green if 25% or greater and red if less than 25%

plot myindicator= (ask - low(period = "day" )[0]) / (high(period = "day" )[1]
- low(period = "day" )[0]);

Thanks for your time!
ST
 
Solution
Good Day UseThinkScript Community,

I have a Watchlist script pasted below that displays the % of the ask between yesterday's high & today's low. I'm hoping someone can help me with a couple simple format changes to the code:

1.) Display the number as a percentage with zero decimal places
2.) Display the number green if 25% or greater and red if less than 25%

plot myindicator= (ask - low(period = "day" )[0]) / (high(period = "day" )[1]
- low(period = "day" )[0]);

Thanks for your time! hal_sort
ST


watchlist study

can't use 2nd agg in column study, removed that
set time to day
can't use ask, replaced with close.
to get rid on trailing 0, i used round() within a label, to generate the output, but it is text, so i added...
Good Day UseThinkScript Community,

I have a Watchlist script pasted below that displays the % of the ask between yesterday's high & today's low. I'm hoping someone can help me with a couple simple format changes to the code:

1.) Display the number as a percentage with zero decimal places
2.) Display the number green if 25% or greater and red if less than 25%

plot myindicator= (ask - low(period = "day" )[0]) / (high(period = "day" )[1]
- low(period = "day" )[0]);

Thanks for your time! hal_sort
ST


watchlist study

can't use 2nd agg in column study, removed that
set time to day
can't use ask, replaced with close.
to get rid on trailing 0, i used round() within a label, to generate the output, but it is text, so i added leading 0's so it sorts correctly.
i changed the limit number, from 25 to 50, to get a few more red colors.


zper_num_0
http://tos.mx/doU2w24


Code:
# zper_num_0
#percent_number_col

#https://usethinkscript.com/threads/watchlist-script-reformat.16687/
#Watchlist Script reFormat
#tsw85  Sep 29, 2023

#I have a Watchlist script pasted below that displays the % of the ask between yesterday's high & today's low. I'm hoping someone can help me with a couple simple format changes to the code:

#1.) Display the number as a percentage with zero decimal places
#2.) Display the number green if 25% or greater and red if less than 25%

#input color_limit = 25;
input color_limit = 50;

# doesn't work
#def myindicator = (ask - low(period = "day" )[0]) / (high(period = "day" )[1] - low(period = "day" )[0]);
#def myindicator = 100*((close - low(period = "day" )[0]) / (high(period = "day" )[1] - low(period = "day" )[0]));
#def myindicator = (ask - low[0]) / (high[1] - low[0]);

# doesn't work
#def AskPrice = close(priceType = PriceType.ASK);
#def myindicator = 100 * ((AskPrice - low[0]) / (high[1] - low[0]));

# this works.  change ask to close.  change to remove 2nd agg refs.  set time to day
def myindicator = 100 * ((close - low[0]) / (high[1] - low[0]));


#plot z1 = round(myindicator,0);
#z1.setdefaultcolor(color.black);

addlabel(1,
(if myindicator < 10 then "00" else if myindicator < 100 then "0" else "") +
round(myindicator,0), color.black);

assignbackgroundcolor(if myindicator > color_limit then color.green else color.red);

#


KDmrUwO.jpg
 
Last edited:
Solution

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