OPEN-SOURCE SCRIPT

Stock vs Sector Comparison with Highlights

This graph is meant as a support to select a stock that is expected to perform better than the sector.

The graph is based on weekly chart. So this is a medium / long term strategy.

How is expected to be used: when the stock has under performed the sector for some time, there is a natural tendence that it will catch up with the sector again. So, for example, if the color change from green to red, you should consider find another stock in the sector. If the stock looses the green color, but is not red yet, you should wait. And vice versa if you start with red. However, life is not that simple, as you can get fake signal. To mitigate this problem, you can adjust the threshold in the input setting, so just go for the signal after x weeks over/underperforming. You also need remember to select the sector in the settings, as the sector is not give automatically when you select the stock.


Below the sectors used:

Sector Name Ticker
S&P 500 (Market Index) SPY
Technology XLK
Financials XLF
Consumer Discretionary XLY
Industrials XLI
Health Care XLV
Consumer Staples XLP
Energy XLE
Utilities XLU
Communication Services XLC
Real Estate XLRE
Materials XLB

Chart patternsCyclesTrend Analysis

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer