Sector Labels - Key Risk - Percent Comparison of ETFs

markos

Well-known member
VIP

Labels to keep you up to Speed on Market Risk

https://tos.mx/BwwQKR
hH7G6ZT.png


Code:
# PctComp - Key Risk ETFs
# 01-22-2017
# Chat request by Blackhatter - Dilbert & Spectrum in TSL

def IWMPctChg = (close("IWM", period = "Day") / close("IWM", period = "Day")[1]) - 1;
AddLabel(1, "IWM" + " = " + AsPercent(IWMPctChg), if IWMPctChg > 0 then Color.GREEN else Color.RED);

def SPYPctChg = (close("SPY", period = "Day") / close("SPY", period = "Day")[1]) - 1;
AddLabel(1, "SPY" + " = " + AsPercent(SPYPctChg), if SPYPctChg > 0 then Color.GREEN else Color.RED);

def EEMPctChg = (close("EEM", period = "Day") / close("EEM", period = "Day")[1]) - 1;
AddLabel(1, "EEM" + " = " + AsPercent(EEMPctChg), if EEMPctChg > 0 then Color.GREEN else Color.RED);

def XLYPctChg = (close("XLY", period = "Day") / close("XLY", period = "Day")[1]) - 1;
AddLabel(1, "XLY" + " = " + AsPercent(XLYPctChg), if XLYPctChg > 0 then Color.GREEN else Color.RED);

def XLPPctChg = (close("XLP", period = "Day") / close("XLP", period = "Day")[1]) - 1;
AddLabel(1, "XLP" + " = " + AsPercent(XLPPctChg), if XLPPctChg > 0 then Color.GREEN else Color.RED);

def XLUPctChg = (close("XLU", period = "Day") / close("XLU", period = "Day")[1]) - 1;
AddLabel(1, "XLU" + " = " + AsPercent(XLUPctChg), if XLUPctChg > 0 then Color.GREEN else Color.RED);

def JNKPctChg = (close("JNK", period = "Day") / close("JNK", period = "Day")[1]) - 1;
AddLabel(1, "JNK" + "  = " + AsPercent(JNKPctChg), if JNKPctChg > 0 then Color.GREEN else Color.RED);

def LQDPctChg = (close("LQD", period = "Day") / close("LQD", period = "Day")[1]) - 1;
AddLabel(1, "LQD" + " = " + AsPercent(LQDPctChg), if LQDPctChg > 0 then Color.GREEN else Color.RED);

AddLabel(1, "IWM - SPY = " + AsPercent(IWMPctChg - SPYPctChg), if IWMPctChg - SPYPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "EEM - SPY = " + AsPercent(EEMPctChg - SPYPctChg), if EEMPctChg - SPYPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "SPY - XLU = " + AsPercent(SPYPctChg - XLUPctChg), if SPYPctChg - XLUPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "XLY - XLP = " + AsPercent(XLYPctChg - XLPPctChg), if XLYPctChg - XLPPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "JNK - LQD = " + AsPercent(JNKPctChg - LQDPctChg), if JNKPctChg - LQDPctChg > 0 then Color.GREEN else Color.RED);

AddLabel(1, "Total = " + AsPercent((IWMPctChg - SPYPctChg) + (EEMPctChg - SPYPctChg) + (SPYPctChg - XLUPctChg) + (XLYPctChg - XLPPctChg) + (JNKPctChg - LQDPctChg)), if ((IWMPctChg - SPYPctChg) + (EEMPctChg - SPYPctChg) + (SPYPctChg - XLUPctChg) + (XLYPctChg - XLPPctChg) + (JNKPctChg - LQDPctChg)) > 0 then color.green else color.red);
#EOC#
 
Last edited:

drasp

Member
Labels to keep you up to Speed on Market Risk

https://tos.mx/BwwQKR
hH7G6ZT.png


Code:
# PctComp - Key Risk ETFs
# 01-22-2017
# Chat request by Blackhatter - Dilbert & Spectrum in TSL

def IWMPctChg = (close("IWM", period = "Day") / close("IWM", period = "Day")[1]) - 1;
AddLabel(1, "IWM" + " = " + AsPercent(IWMPctChg), if IWMPctChg > 0 then Color.GREEN else Color.RED);

def SPYPctChg = (close("SPY", period = "Day") / close("SPY", period = "Day")[1]) - 1;
AddLabel(1, "SPY" + " = " + AsPercent(SPYPctChg), if SPYPctChg > 0 then Color.GREEN else Color.RED);

def EEMPctChg = (close("EEM", period = "Day") / close("EEM", period = "Day")[1]) - 1;
AddLabel(1, "EEM" + " = " + AsPercent(EEMPctChg), if EEMPctChg > 0 then Color.GREEN else Color.RED);

def XLYPctChg = (close("XLY", period = "Day") / close("XLY", period = "Day")[1]) - 1;
AddLabel(1, "XLY" + " = " + AsPercent(XLYPctChg), if XLYPctChg > 0 then Color.GREEN else Color.RED);

def XLPPctChg = (close("XLP", period = "Day") / close("XLP", period = "Day")[1]) - 1;
AddLabel(1, "XLP" + " = " + AsPercent(XLPPctChg), if XLPPctChg > 0 then Color.GREEN else Color.RED);

def XLUPctChg = (close("XLU", period = "Day") / close("XLU", period = "Day")[1]) - 1;
AddLabel(1, "XLU" + " = " + AsPercent(XLUPctChg), if XLUPctChg > 0 then Color.GREEN else Color.RED);

def JNKPctChg = (close("JNK", period = "Day") / close("JNK", period = "Day")[1]) - 1;
AddLabel(1, "JNK" + "  = " + AsPercent(JNKPctChg), if JNKPctChg > 0 then Color.GREEN else Color.RED);

def LQDPctChg = (close("LQD", period = "Day") / close("LQD", period = "Day")[1]) - 1;
AddLabel(1, "LQD" + " = " + AsPercent(LQDPctChg), if LQDPctChg > 0 then Color.GREEN else Color.RED);

AddLabel(1, "IWM - SPY = " + AsPercent(IWMPctChg - SPYPctChg), if IWMPctChg - SPYPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "EEM - SPY = " + AsPercent(EEMPctChg - SPYPctChg), if EEMPctChg - SPYPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "SPY - XLU = " + AsPercent(SPYPctChg - XLUPctChg), if SPYPctChg - XLUPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "XLY - XLP = " + AsPercent(XLYPctChg - XLPPctChg), if XLYPctChg - XLPPctChg > 0 then Color.GREEN else Color.RED);
AddLabel(1, "JNK - LQD = " + AsPercent(JNKPctChg - LQDPctChg), if JNKPctChg - LQDPctChg > 0 then Color.GREEN else Color.RED);

AddLabel(1, "Total = " + AsPercent((IWMPctChg - SPYPctChg) + (EEMPctChg - SPYPctChg) + (SPYPctChg - XLUPctChg) + (XLYPctChg - XLPPctChg) + (JNKPctChg - LQDPctChg)), if ((IWMPctChg - SPYPctChg) + (EEMPctChg - SPYPctChg) + (SPYPctChg - XLUPctChg) + (XLYPctChg - XLPPctChg) + (JNKPctChg - LQDPctChg)) > 0 then color.green else color.red);
#EOC#
can this indicator be elaborated on and on how its used?
if the total is negative does that mean that the market is bearish? or does it mean risk off? etc.
I'm curious to know more.
 
Last edited by a moderator:

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
can this indicator be elaborated on and on how its used?
if the total is negative does that mean that the market is bearish? or does it mean risk off? etc.
I'm curious to know more.
It displays which sectors are trending and which are not.

How to use:
If a stock correlates with its index closely, one would not look for a bullish setup, if its sector is doing poorly.
 

drasp

Member
It displays which sectors are trending and which are not.

How to use:
If a stock correlates with its index closely, one would not look for a bullish setup, if its sector is doing poorly.
theres something called a total at the end, I guess thats what throws me off. As well as EEM - SPY and SPY - XLU
 

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
theres something called a total at the end, I guess thats what throws me off. As well as EEM - SPY and SPY - XLU
The first is lets you know overall bull or bear.
The second are just added comparisons to show who is trend-iest ;)
 
Last edited:

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.
Top