OPEN-SOURCE SCRIPT
Comparative Relative Strength - SJ

OVERVIEW
Comparative Relative Strength (CRS) measures how a symbol is performing against a benchmark index, rather than on its own. It answers a single question: is this stock doing better or worse than the market it trades in? The script is built for traders who use the Wyckoff method, where a key buying condition is a stock that is stronger than the market, and a key selling condition is a stock that is weaker than the market.
HOW IT WORKS
1. The CRS line (grey) is the ratio of the chart symbol's close to the benchmark's close on the same timeframe. When the line rises, the symbol is outperforming the benchmark. When it falls, the symbol is underperforming, even if its price is rising.
2. The smoothed line (navy) is a moving average of the CRS line (EMA by default, 22 bars, which is about one trading month on a daily chart). It shows the underlying relative-strength trend and filters out single-bar noise.
3. The fill between the two lines is green when CRS is above its average (relative strength improving) and red when it is below (relative strength deteriorating).
4. Turn markers: a green dot at the bottom marks the bar on which CRS crosses above its average. A red dot at the top marks the bar on which it crosses below.
5. ROC mode: the raw ratio depends on the price levels of the two instruments, so ratio values cannot be compared between symbols. ROC mode plots the percentage rate of change of the ratio instead. This number is scale-free and means the same thing on every symbol. It is also output to the Data Window, where it can be read by a screener to rank symbols by relative strength.
HOW TO USE IT
- Choose the benchmark that matches the market the symbol trades in (for example, a Saudi stock against the TASI index, or a US technology stock against the Nasdaq 100). A mismatched benchmark gives a meaningless reading.
- For long setups, look for symbols whose CRS is rising and above its average while the benchmark is flat or falling. Such a stock is being supported against the market and often leads when the market turns up.
- For short setups or exits, look for CRS falling below its average while the benchmark is flat or rising. The stock is lagging and failing to join the market's strength.
- Use ROC mode when comparing several symbols. The symbol with the highest positive ROC is the strongest relative to the benchmark over the chosen period.
- CRS is a filter for choosing what to trade, not a timing signal on its own. Combine it with price and volume analysis of the symbol itself.
INPUTS
- Benchmark index: the symbol used as the comparison.
- Smoothing length: the length of the average (default 22).
- Smoothing type: EMA or SMA.
- Mode: Ratio (for reading one chart) or ROC (for comparing symbols).
- ROC length: the look-back for ROC mode (default 22).
- Mark the turns: shows or hides the crossover dots.
ALERTS
- CRS turn up: CRS crossed above its average.
- CRS turn down: CRS crossed below its average.
LIMITATIONS
- Crossovers are frequent in sideways conditions and will produce several turn markers in a short period. Read them together with the direction of the smoothed line.
- If the symbol and the benchmark trade on different days or sessions, the script uses the benchmark's last available close on bars where the benchmark did not trade. Readings on those bars can lag.
- Values are calculated on bar close; the reading on the current, unfinished bar will change until the bar closes. The script does not repaint closed bars and does not use future data.
- Relative strength describes the past. It does not predict future performance.
Comparative Relative Strength (CRS) measures how a symbol is performing against a benchmark index, rather than on its own. It answers a single question: is this stock doing better or worse than the market it trades in? The script is built for traders who use the Wyckoff method, where a key buying condition is a stock that is stronger than the market, and a key selling condition is a stock that is weaker than the market.
HOW IT WORKS
1. The CRS line (grey) is the ratio of the chart symbol's close to the benchmark's close on the same timeframe. When the line rises, the symbol is outperforming the benchmark. When it falls, the symbol is underperforming, even if its price is rising.
2. The smoothed line (navy) is a moving average of the CRS line (EMA by default, 22 bars, which is about one trading month on a daily chart). It shows the underlying relative-strength trend and filters out single-bar noise.
3. The fill between the two lines is green when CRS is above its average (relative strength improving) and red when it is below (relative strength deteriorating).
4. Turn markers: a green dot at the bottom marks the bar on which CRS crosses above its average. A red dot at the top marks the bar on which it crosses below.
5. ROC mode: the raw ratio depends on the price levels of the two instruments, so ratio values cannot be compared between symbols. ROC mode plots the percentage rate of change of the ratio instead. This number is scale-free and means the same thing on every symbol. It is also output to the Data Window, where it can be read by a screener to rank symbols by relative strength.
HOW TO USE IT
- Choose the benchmark that matches the market the symbol trades in (for example, a Saudi stock against the TASI index, or a US technology stock against the Nasdaq 100). A mismatched benchmark gives a meaningless reading.
- For long setups, look for symbols whose CRS is rising and above its average while the benchmark is flat or falling. Such a stock is being supported against the market and often leads when the market turns up.
- For short setups or exits, look for CRS falling below its average while the benchmark is flat or rising. The stock is lagging and failing to join the market's strength.
- Use ROC mode when comparing several symbols. The symbol with the highest positive ROC is the strongest relative to the benchmark over the chosen period.
- CRS is a filter for choosing what to trade, not a timing signal on its own. Combine it with price and volume analysis of the symbol itself.
INPUTS
- Benchmark index: the symbol used as the comparison.
- Smoothing length: the length of the average (default 22).
- Smoothing type: EMA or SMA.
- Mode: Ratio (for reading one chart) or ROC (for comparing symbols).
- ROC length: the look-back for ROC mode (default 22).
- Mark the turns: shows or hides the crossover dots.
ALERTS
- CRS turn up: CRS crossed above its average.
- CRS turn down: CRS crossed below its average.
LIMITATIONS
- Crossovers are frequent in sideways conditions and will produce several turn markers in a short period. Read them together with the direction of the smoothed line.
- If the symbol and the benchmark trade on different days or sessions, the script uses the benchmark's last available close on bars where the benchmark did not trade. Readings on those bars can lag.
- Values are calculated on bar close; the reading on the current, unfinished bar will change until the bar closes. The script does not repaint closed bars and does not use future data.
- Relative strength describes the past. It does not predict future performance.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.