TradingView
Tom1trader
5. Febr. 2022 23:29

S&P Sector Advance/Decline Weighted -Tom1trader 

SPDR S&P 500 ETF TRUSTArca

Beschreibung

Enjoy, enhance your trading (I hope), copy or adapt to your needs and keep smiling!

Thanks to @MartinShkreli. The sector variables and the "repaint" option (approx lines 20 through 32 of this script) are used directly from your script "Sectors"
RECOMMENDATION: Update the sector weightings -inputs are provided. They change as often as monthly and the
annual changes are certainly significant. When updating weighting percentages use the decimal value. I.E. 29% is .29

Good on any time frame. Especially SPY, SPX and ES scalpers and 0DTE options traders may like this a lot.

This gives good signals on S & P and related (ES, SPY) and indicates / plots differently than the AD line or ratio.
Each sector's entire % weight is added or subtracted depending of whether that sector advanced or declined.
Example: Information Tech weight at 29% so that % of 500 (145) is added if InfoTech is up a penny and subtracted if it is
down a penny. All sectors processed the same way so that for a given bar/candle the value will be between +500 (all
sectors up) and -500 (all sectors down). This weighted AD line of sectors is scaled to +/- 350 and plotted as a red/green line
along with aqua/fuchsia columns of its 5 period ema. The line is actual sector behavior and the columns seem to make a
good signal with column zero crosses standing out.

The columns aqua / fuchsia are a 5 period ema of the Sector AD line and give pretty good signals at
zero cross for SPX. I colored the AD red green line also to emphasize the times it opposes the ema
for example the histo/colums zero cross signal is NOT true when the AD line is showing all or most sectors
going the other way.

For readability, the AD line itself is scaled to 350. This lets the columns of the ema stand out better. The hlines at
350 and at 175 give an idea for the AD green red line how much of the sector's weight is up or down.
350 is all sectors up (advancing) and -350 is all sectors down (declining). The hlines at +/- 175 seem to outline
a more or less "neutral" zone. For example in an uptrend with most of the AD level positive and the columns positive;
a negative spike that does not pass the -175 line and returns positive does not seem to impact the price as much as
a deeper negative spike.

Versionshinweise

Thanks to @MartinShkreli. The sector function, variables & "repaint" (approx lines 28 through 43 of this script)
are used directly from your script "Sectors"
RECOMMENDATION: Update the sector weightings -inputs are provided. They change as often as monthly and the
annual changes are certainly significant.
When updating weighting percentages use the decimal value. I.E. 29% is .29
All sectors advanced is line at +1 and declined at -1
Line values between +/- 1 represent percentage of sector weight that advanced or declined

The weight (%[as decimal] S&P mkt cap) is added if advances or subtracted if declines
i.e infotech sector was 26% of S&P when I did this so .26 added/subtracted when advance/decline.
The columns aqua fuchsia are a 5 period Hull Moving Average [changed from EMA]

Zero Cross of this histo/columns give pretty good signals for S&P.
Above/below zero track pretty well as price rising/falling.
The space between plus 0.5 and minus 0.5 is more neutral such that
when histo is between them price is rising or falling more slowly
or price is ranging when histo straddles back and forth + and -.
I colored the AD line also to emphasize the times it opposes the histo.

--New version changes: [2-21-22]
- EMA to Hull Moving Average
- Scaling to +/- 1 simplifies code and inputs
- Choice of plot multiple for histo readability (1x-2x in 0.1 steps)
- Cleaned up and clarified description

Versionshinweise

Updated the sector weightings per Yahoo Finance, link in description. The original source of the weightings no longer posts them on their web site so changed to Yahoo's. Changed input dialogue on Consumer Staples and Discretionary to show that discretionary is also cyclical and stapes is also defensive. If you update with the inputs provided it is clear when yahoo says only cyclical it is the same as discretionary and same with defensive/staples.
Kommentare
knowledgeinvestmentgroupllc
Thank you very much !
GoldGummyBear
Hi, great indicator. I look forward to using it. As a default, repaint box was checked. I added the new weightings but do I need to uncheck the repaint box or leave it as is after adding the new weightings? Thank you very much!
philelmo
where do I find the new/updated sector weights numbers so that I can input/change it?
Tom1trader
@philelmo, Thanks for question! Many places on line, the ones I used are from siblisresearch.com the exact line is in a comment on line 58 of the code above.
MTGTrading
@philelmo, Go to this link and click the "Sector Breakdown" option on the left side. spglobal.com/spdji/en/indices/equity/sp-500/
Tom1trader
@MTGTrading, Thanks, will compare its updating to the one I used: finance.yahoo.com/quote/SPY/holdings/. Happy trading and keep smiling!
JohnOtaran
Thanks for this indicator. What does the change of column color from aqua to fuchsia indicate ? because I see it above zero as well as below. So when the SPY is green and head up , the column is still sometimes fuchsia and vice versa
Tom1trader
@JohnOtaran, Hi and thanks for question. Plot value is a 5 period Hull moving average of the [red/green] "advance/decline". Line 89 of code above sets the color to a greater value than previous value is aqua and a lesser value is fuchsia. In the unlikely event the value has not changed at all it would plot gray. So average advancing aqua and declining fuchsia.
megaip
Thanks for this indicator. How can we use this efficiently during SPX/SPY lotto day?
Tom1trader
@megaip, You are welcome! Do not know "lotto day". That said, as with any indicator choose time frame best for your strategy, understand the line is simple sum of sector weights (+ or added for advancing sectors and vice versa declining sectors) so in the same bar the index will be tending per net plus or minus, especially when reading +1.0 or -1.0 (all sectors up or all sectors down). As with any indicator everything can change with the next bar/candle. The columns/histogram plots a fast average for easier tendency visibility.
Mehr