Beat the market

Status
Not open for further replies.

Headhunter20

New member

Is there any type of indicator that displays the percentage of a stock gain over or under the percentage of the SPY? or relative percentages?
Can that even be done? I was just thinking to beat the market, you just have to own stocks that are gaining a higher percentage of the market. I am new to this. Let me know if I am way off base if you would please. Would be nice if people could scan for this. ? . ?
 
Last edited by a moderator:
Solution
Actually I thought it would be harder to do.... but your comment gave me an idea and I actually modified an indicator !!!!!!!
Thank you.
Here it is if you want to take a look. I don't remember where I got the initial indicator. On this website maybe? Here it is.
Ruby:
# S&P 500 Sector Performance (Percentage)
# Paris
# 4.12.2018
# After reviewing chubbyboy's S&P sector study, I thought it might
# be a good idea to display labels of relative S&P sector performance
# in percentages. At one glance this will enable us to determine
# which sectors are happening and which are not. Decided to use a
# script() to retrieve the data. Also, I changed the formula slightly.
# The percentage displayed is the current price as a percentage over
#...
Is there any type of indicator that displays the percentage of a stock gain over or under the percentage of the SPY? or relative percentages?
Can that even be done? I was just thinking to beat the market, you just have to own stocks that are gaining a higher percentage of the market. I am new to this. Let me know if I am way off base if you would please. Would be nice if people could scan for this. ? . ?
Thats an interesting idea, I have used relative strength (not rsi) but I dont like it, I think you can win if you study when it works, but often times something that is above the SPY might be toping off, I think relative strength does work best before a SPY/MARKET reversal, meaning of everything is falling and something is falling less, when the market starts to reverse it might be a sign that that equity was strong even during a sell off, which might indicate that a stronger reversal or a higher chance of winning might be in play. Be careful with what I'm saying because I only play the SPY and sometimes the qqq, but I do look at the relationships between these and the VIX and DOW. There is an indicator by movious sort of like is like relative strength as a stochastic.
 
I have used the "comparison" chart in TOS and found it interesting that a given stock may cross above the spy line and I began to wonder if there was a way to scan for that. I am most interested in the crossover of the two. (Stock % crossing above the SPY %) Would it be useable?
 
I have used the "comparison" chart in TOS and found it interesting that a given stock may cross above the spy line and I began to wonder if there was a way to scan for that. I am most interested in the crossover of the two. (Stock % crossing above the SPY %) Would it be useable?
Backtest, you'll probably see if it works. But im bot sure how to scan for comparison
 
Actually I thought it would be harder to do.... but your comment gave me an idea and I actually modified an indicator !!!!!!!
Thank you.
Here it is if you want to take a look. I don't remember where I got the initial indicator. On this website maybe? Here it is.
Ruby:
# S&P 500 Sector Performance (Percentage)
# Paris
# 4.12.2018
# After reviewing chubbyboy's S&P sector study, I thought it might
# be a good idea to display labels of relative S&P sector performance
# in percentages. At one glance this will enable us to determine
# which sectors are happening and which are not. Decided to use a
# script() to retrieve the data. Also, I changed the formula slightly.
# The percentage displayed is the current price as a percentage over
# yesterday's closing rather than the open today as was used in chubbyboy's
# study.
#====== Further Modified by Killing Hours ======#
# 5/4/2020 #
# Added Color Mapping #
# to distinguish more suddle movements #
#===============================================#
Modified slightly by Headhunter20.


######################################################################################
script Sector {
input symb = "SPX";
def c = close(symbol = symb, period = AggregationPeriod.day);
def PctChg = (c / c[1]) - 1;
plot pct = PctChg;
}

#Define the color map. Change as you see fit
DefineGlobalColor("VeryGood", CreateColor(4, 216, 22));
DefineGlobalColor("Good", CreateColor(46, 216, 4));
DefineGlobalColor("ModGood", CreateColor(121, 216, 4));
DefineGlobalColor("SlightlyGood", CreateColor(167, 216, 4));
DefineGlobalColor("SluggishGood", CreateColor(210,252,126));
DefineGlobalColor("Neutral", CreateColor(252, 231, 126));
DefineGlobalColor("SluggishBad", CreateColor(252,168,126));
DefineGlobalColor("SlightlyBad", CreateColor(216, 163, 4));
DefineGlobalColor("ModBad", CreateColor(216, 117, 4));
DefineGlobalColor("Bad", CreateColor(216, 43, 4));
DefineGlobalColor("VeryBad", CreateColor(216, 4, 4));

# SPX Overall
def SPX = Sector("SPX");
def spxPer = round(SPX,4) * 100;
AddLabel(
1,
"S&P 500: " +spxPer+"%",
if spxPer > 1.50 then GlobalColor("VeryGood") else
if spxPer > 1 && spxPer <= 1.50 then GlobalColor("Good") else
if spxPer > .5 && spxPer <= 1 then GlobalColor("ModGood") else
if spxPer > .25 && spxPer <= .5 then GlobalColor("SlightlyGood") else
if spxPer > 0 && spxPer <= .25 then GlobalColor("SluggishGood") else
if spxPer == 0 then GlobalColor("Neutral") else
if spxPer < 0 && spxPer >= -.25 then GlobalColor("SluggishBad") else
if spxPer < -.25 && spxPer >= -.5 then GlobalColor("SlightlyBad") else
if spxPer < -.5 && spxPer >= -1 then GlobalColor("ModBad") else
if spxPer < -1 && spxPer >= -1.50 then GlobalColor("Bad") else
if spxPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Energy Sector
def Energy = Sector("$SP500#10");
def engPer = round(Energy,4) * 100;
AddLabel(
1,
"Energy: "+engPer+"% XLE #10",
if engPer > 1.50 then GlobalColor("VeryGood") else
if engPer > 1 && engPer <= 1.50 then GlobalColor("Good") else
if engPer > .5 && engPer <= 1 then GlobalColor("ModGood") else
if engPer > .25 && engPer <= .5 then GlobalColor("SlightlyGood") else
if engPer > 0 && engPer <= .25 then GlobalColor("SluggishGood") else
if engPer == 0 then GlobalColor("Neutral") else
if engPer < 0 && engPer >= -.25 then GlobalColor("SluggishBad") else
if engPer < -.25 && engPer >= -.5 then GlobalColor("SlightlyBad") else
if engPer < -.5 && engPer >= -1 then GlobalColor("ModBad") else
if engPer < -1 && engPer >= -1.50 then GlobalColor("Bad") else
if engPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Consumer Discretionary Spending Sector
def ConDisr = Sector("$SP500#25");
def conDPer = round(ConDisr,4);
AddLabel(
1,
"Con. Discretionary: "+conDPer+"% XLY #25",
if conDPer > 1.50 then GlobalColor("VeryGood") else
if conDPer > 1 && conDPer <= 1.50 then GlobalColor("Good") else
if conDPer > .5 && conDPer <= 1 then GlobalColor("ModGood") else
if conDPer > .25 && conDPer <= .5 then GlobalColor("SlightlyGood") else
if conDPer > 0 && conDPer <= .25 then GlobalColor("SluggishGood") else
if conDPer == 0 then GlobalColor("Neutral") else
if conDPer < 0 && conDPer >= -.25 then GlobalColor("SluggishBad") else
if conDPer < -.25 && conDPer >= -.5 then GlobalColor("SlightlyBad") else
if conDPer < -.5 && conDPer >= -1 then GlobalColor("ModBad") else
if conDPer < -1 && conDPer >= -1.50 then GlobalColor("Bad") else
if conDPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Financial Sector
def Finance = Sector("$SP500#40");
def finPer = round(Finance,4) * 100;
AddLabel(
1,
"Financials: "+finPer+"% XLF #40",
if finPer > 1.50 then GlobalColor("VeryGood") else
if finPer > 1 && finPer <= 1.50 then GlobalColor("Good") else
if finPer > .5 && finPer <= 1 then GlobalColor("ModGood") else
if finPer > .25 && finPer <= .5 then GlobalColor("SlightlyGood") else
if finPer > 0 && finPer <= .25 then GlobalColor("SluggishGood") else
if finPer == 0 then GlobalColor("Neutral") else
if finPer < 0 && finPer >= -.25 then GlobalColor("SluggishBad") else
if finPer < -.25 && finPer >= -.5 then GlobalColor("SlightlyBad") else
if finPer < -.5 && finPer >= -1 then GlobalColor("ModBad") else
if finPer < -1 && finPer >= -1.50 then GlobalColor("Bad") else
if finPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Utilities Sector
def Utilities = Sector("$SP500#55");
def utiPer = round(Utilities,4) * 100;
AddLabel(
1,
"Utilities: "+utiPer+"% XLU #55",
if utiPer > 1.50 then GlobalColor("VeryGood") else
if utiPer > 1 && utiPer <= 1.50 then GlobalColor("Good") else
if utiPer > .5 && utiPer <= 1 then GlobalColor("ModGood") else
if utiPer > .25 && utiPer <= .5 then GlobalColor("SlightlyGood") else
if utiPer > 0 && utiPer <= .25 then GlobalColor("SluggishGood") else
if utiPer == 0 then GlobalColor("Neutral") else
if utiPer < 0 && utiPer >= -.25 then GlobalColor("SluggishBad") else
if utiPer < -.25 && utiPer >= -.5 then GlobalColor("SlightlyBad") else
if utiPer < -.5 && utiPer >= -1 then GlobalColor("ModBad") else
if utiPer < -1 && utiPer >= -1.50 then GlobalColor("Bad") else
if utiPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Materials Sector
def Materials = Sector("$SP500#15");
def matPer = round(Materials,4) * 100;
AddLabel(
1,
"Materials: "+matPer+"% XLB #15",
if matPer > 1.50 then GlobalColor("VeryGood") else
if matPer > 1 && matPer <= 1.50 then GlobalColor("Good") else
if matPer > .5 && matPer <= 1 then GlobalColor("ModGood") else
if matPer > .25 && matPer <= .5 then GlobalColor("SlightlyGood") else
if matPer > 0 && matPer <= .25 then GlobalColor("SluggishGood") else
if matPer == 0 then GlobalColor("Neutral") else
if matPer < 0 && matPer >= -.25 then GlobalColor("SluggishBad") else
if matPer < -.25 && matPer >= -.5 then GlobalColor("SlightlyBad") else
if matPer < -.5 && matPer >= -1 then GlobalColor("ModBad") else
if matPer < -1 && matPer >= -1.50 then GlobalColor("Bad") else
if matPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Consumer Staples Sector
def ConStaple = Sector("$SP500#30");
def conSPer = round(ConStaple,4) * 100;
AddLabel(
1,
"Consumer Staples: "+conSPer+"% XLP #30",
if conSPer > 1.50 then GlobalColor("VeryGood") else
if conSPer > 1 && conSPer <= 1.50 then GlobalColor("Good") else
if conSPer > .5 && conSPer <= 1 then GlobalColor("ModGood") else
if conSPer > .25 && conSPer <= .5 then GlobalColor("SlightlyGood") else
if conSPer > 0 && conSPer <= .25 then GlobalColor("SluggishGood") else
if conSPer == 0 then GlobalColor("Neutral") else
if conSPer < 0 && conSPer >= -.25 then GlobalColor("SluggishBad") else
if conSPer < -.25 && conSPer >= -.5 then GlobalColor("SlightlyBad") else
if conSPer < -.5 && conSPer >= -1 then GlobalColor("ModBad") else
if conSPer < -1 && conSPer >= -1.50 then GlobalColor("Bad") else
if conSPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Information Technology Sector
def InfoTech = Sector("$SP500#45");
def infPer = round(InfoTech,4) * 100;
AddLabel(
1,
"Info Tech: " +infPer+"% XLK #45",
if infPer > 1.50 then GlobalColor("VeryGood") else
if infPer > 1 && infPer <= 1.50 then GlobalColor("Good") else
if infPer > .5 && infPer <= 1 then GlobalColor("ModGood") else
if infPer > .25 && infPer <= .5 then GlobalColor("SlightlyGood") else
if infPer > 0 && infPer <= .25 then GlobalColor("SluggishGood") else
if infPer == 0 then GlobalColor("Neutral") else
if infPer < 0 && infPer >= -.25 then GlobalColor("SluggishBad") else
if infPer < -.25 && infPer >= -.5 then GlobalColor("SlightlyBad") else
if infPer < -.5 && infPer >= -1 then GlobalColor("ModBad") else
if infPer < -1 && infPer >= -1.50 then GlobalColor("Bad") else
if infPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Real Estate Sector
def RealEste = Sector("$SP500#60");
def reaPer = round(RealEste,4) * 100;
AddLabel(
1,
"Real Estate: " +reaPer+"% XLRE #60",
if reaPer > 1.50 then GlobalColor("VeryGood") else
if reaPer > 1 && reaPer <= 1.50 then GlobalColor("Good") else
if reaPer > .5 && reaPer <= 1 then GlobalColor("ModGood") else
if reaPer > .25 && reaPer <= .5 then GlobalColor("SlightlyGood") else
if reaPer > 0 && reaPer <= .25 then GlobalColor("SluggishGood") else
if reaPer == 0 then GlobalColor("Neutral") else
if reaPer < 0 && reaPer >= -.25 then GlobalColor("SluggishBad") else
if reaPer < -.25 && reaPer >= -.5 then GlobalColor("SlightlyBad") else
if reaPer < -.5 && reaPer >= -1 then GlobalColor("ModBad") else
if reaPer < -1 && reaPer >= -1.50 then GlobalColor("Bad") else
if reaPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);


# Industrial Sector
def Industrl = Sector("$SP500#20");
def indPer = round(Industrl,4) * 100;
AddLabel(
1,
"Industrials: " +indPer+"% XLI #20",
if indPer > 1.50 then GlobalColor("VeryGood") else
if indPer > 1 && indPer <= 1.50 then GlobalColor("Good") else
if indPer > .5 && indPer <= 1 then GlobalColor("ModGood") else
if indPer > .25 && indPer <= .5 then GlobalColor("SlightlyGood") else
if indPer > 0 && indPer <= .25 then GlobalColor("SluggishGood") else
if indPer == 0 then GlobalColor("Neutral") else
if indPer < 0 && indPer >= -.25 then GlobalColor("SluggishBad") else
if indPer < -.25 && indPer >= -.5 then GlobalColor("SlightlyBad") else
if indPer < -.5 && indPer >= -1 then GlobalColor("ModBad") else
if indPer < -1 && indPer >= -1.50 then GlobalColor("Bad") else
if indPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Healthcare Sector
def Health = Sector("$SP500#35");
def heaPer = round(Health,4) * 100;
AddLabel(
1,
"Health Care: " +heaPer+"% XLV #35",
if heaPer > 1.50 then GlobalColor("VeryGood") else
if heaPer > 1 && heaPer <= 1.50 then GlobalColor("Good") else
if heaPer > .5 && heaPer <= 1 then GlobalColor("ModGood") else
if heaPer > .25 && heaPer <= .5 then GlobalColor("SlightlyGood") else
if heaPer > 0 && heaPer <= .25 then GlobalColor("SluggishGood") else
if heaPer == 0 then GlobalColor("Neutral") else
if heaPer < 0 && heaPer >= -.25 then GlobalColor("SluggishBad") else
if heaPer < -.25 && heaPer >= -.5 then GlobalColor("SlightlyBad") else
if heaPer < -.5 && heaPer >= -1 then GlobalColor("ModBad") else
if heaPer < -1 && heaPer >= -1.50 then GlobalColor("Bad") else
if heaPer < -1.50 then GlobalColor("VeryBad") else
Color.black
);

# Telecommunication Sector
def Telecoms = Sector("$SP500#50");
def telPef = round(Telecoms,4) * 100;
AddLabel(
1,
"Telecoms: " +telPef+"% XLC #50",
if telPef > 1.50 then GlobalColor("VeryGood") else
if telPef > 1 && telPef <= 1.50 then GlobalColor("Good") else
if telPef > .5 && telPef <= 1 then GlobalColor("ModGood") else
if telPef > .25 && telPef <= .5 then GlobalColor("SlightlyGood") else
if telPef > 0 && telPef <= .25 then GlobalColor("SluggishGood") else
if telPef == 0 then GlobalColor("Neutral") else
if telPef < 0 && telPef >= -.25 then GlobalColor("SluggishBad") else
if telPef < -.25 && telPef >= -.5 then GlobalColor("SlightlyBad") else
if telPef < -.5 && telPef >= -1 then GlobalColor("ModBad") else
if telPef < -1 && telPef >= -1.50 then GlobalColor("Bad") else
if telPef < -1.50 then GlobalColor("VeryBad") else
Color.black
);
# End Study
 
Last edited by a moderator:
Solution
@Headhunter20 This is the original header for the study you posted -
Code:
# S&P 500 Sector Performance (Percentage)
# Paris
# 4.12.2018
# After reviewing chubbyboy's S&P sector study, I thought it might
# be a good idea to display labels of relative S&P sector performance
# in percentages. At one glance this will enable us to determine
# which sectors are happening and which are not. Decided to use a
# script() to retrieve the data. Also, I changed the formula slightly.
# The percentage displayed is the current price as a percentage over
# yesterday's closing rather than the open today as was used in chubbyboy's
# study.
#====== Further Modified by Killing Hours ======#
#                   5/4/2020                    #
#             Added Color Mapping               #
#      to distinguish more suddle movements     #
#===============================================#

The code can be found under the author KillingHours in the ThinkScript Lounge OneNote - https://onedrive.live.com/redir?resid=2FF733D1BA1E1E79!404&authkey=!ABOXXFyQg1iUqFk&page=View&wd=target(04. By Author/KillingHours.one|309ae8b3-138b-4d9b-9ffb-b58774cecc93/Sector Performance Labels|0097c579-d233-4c7b-a9ce-109a8bd6e7b8/)

 
Last edited by a moderator:
Status
Not open for further replies.

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