Visualizing Percent Changes in Watchlist/Marketwatch

ruley

New member
I was watching Pat Mullaly's video where referenced a table under his Marketwatch tab that shows multiple columns with percent changes over different time periods. Each cell background changes color depending on the percent gained/lost.

A preview of what he is doing can be seen here

Does anyone know what the script is for this?

Many thanks for your help.
 
I was watching Pat Mullaly's video where referenced a table under his Marketwatch tab that shows multiple columns with percent changes over different time periods. Each cell background changes color depending on the percent gained/lost.

A preview of what he is doing can be seen here

Does anyone know what the script is for this?

Many thanks for your help.
@ruley - this is what I use. You can change to meet your needs.

Code:
plot PerformanceValue = Round ((close - close[63]) / close[63] * 100);

AddLabel(yes, PerformanceValue + "%", color.BLACK);
AssignBackgroundColor(if PerformanceValue < 0
                      then Color.DARK_RED
                      else if PerformanceValue > 0
                      then Color.DARK_GREEN
                      else color.LIGHT_GRAY);
 

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

@ruley - this is what I use. You can change to meet your needs.

Code:
plot PerformanceValue = Round ((close - close[63]) / close[63] * 100);

AddLabel(yes, PerformanceValue + "%", color.BLACK);
AssignBackgroundColor(if PerformanceValue < 0
                      then Color.DARK_RED
                      else if PerformanceValue > 0
                      then Color.DARK_GREEN
                      else color.LIGHT_GRAY);
Thanks. i'll give this a try.
 
So I found the shared link to those custom columns on Twitter -
One question I have when analyzing the shared scripts is the formulas seem off. For instance the 4 week % return is:

def stk = round(((close / close[21])-1)*100,2);

def bmark = round(((close("SPX") / close("SPX")[21])-1)*100,2);

def c = stk-bmark;

plot data = stk;

data.AssignValueColor(color.BLACK);

AssignBackgroundColor (if c > 0 then color.GREEN else if C < 0 then color.Red else color.gray);

close[21])-1 is 4 weeks times 5 trading days Mon - Fri, which makes sense. The 1 wk, 2wk and 3 wk follow a similar pattern close[6])-1, close[11])-1, and close[16])-1 respectively.

BUT then the 5 week % return is

def stk = round(((close / close[29])-1)*100,2);

def bmark = round(((close("SPX") / close("SPX")[29])-1)*100,2);

def c = stk-bmark;

plot data = stk;

data.AssignValueColor(color.BLACK);

AssignBackgroundColor (if c > 0 then color.GREEN else if C < 0 then color.Red else color.gray);

close[29])-1) ??? I don't get it.
the 6 wk is close[36])-1), and it goes on from there (7 wk is close[43])-1).

Anyone have any thoughts as to why it does this?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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