OPEN-SOURCE SCRIPT
업데이트됨 Compare Strength with SLOPE

Description
This indicator compares the relative strength between the current asset and a benchmark (e.g., BTC vs. ETH or AAPL vs. SPY) using a linear regression slope of their ratio over time.
The ratio is calculated as: close / benchmark
A linear regression slope is computed over a user-defined window
The slope represents trend strength: if it’s rising, the current asset is outperforming the benchmark
Plots
Gray Line: The raw ratio between the asset and benchmark
Orange Line: The slope of the ratio (shows momentum)
Background Color:
Green: The asset is significantly stronger than the benchmark
Red: The asset is significantly weaker than the benchmark
No color: No clear trend
Settings
Slope Window Length: Number of candles used in the regression (default = 10)
Slope Threshold: Sensitivity of trend detection. Smaller values detect weaker trends.
Example Use Cases
Style Rotation Strategy: Use the slope to determine whether "Growth" or "Value" style is leading.
Pair Trading / Relative Performance: Track which asset is leading in a pair (e.g., BTC vs ETH).
Factor Timing: Serve as a timing model to allocate between different sectors or factors.
Happy trading!
This indicator compares the relative strength between the current asset and a benchmark (e.g., BTC vs. ETH or AAPL vs. SPY) using a linear regression slope of their ratio over time.
The ratio is calculated as: close / benchmark
A linear regression slope is computed over a user-defined window
The slope represents trend strength: if it’s rising, the current asset is outperforming the benchmark
Plots
Gray Line: The raw ratio between the asset and benchmark
Orange Line: The slope of the ratio (shows momentum)
Background Color:
Green: The asset is significantly stronger than the benchmark
Red: The asset is significantly weaker than the benchmark
No color: No clear trend
Settings
Slope Window Length: Number of candles used in the regression (default = 10)
Slope Threshold: Sensitivity of trend detection. Smaller values detect weaker trends.
Example Use Cases
Style Rotation Strategy: Use the slope to determine whether "Growth" or "Value" style is leading.
Pair Trading / Relative Performance: Track which asset is leading in a pair (e.g., BTC vs ETH).
Factor Timing: Serve as a timing model to allocate between different sectors or factors.
Happy trading!
릴리즈 노트
Indicator Name: Relative Strength SlopePurpose:
Compare the strength of the current asset to a benchmark (e.g. BTC vs ETH or stock vs index) by computing the linear regression slope of their price ratio.
Inputs:
Benchmark Symbol: Reference symbol to compare against.
Slope Window: Number of bars used to calculate the slope.
Threshold: Minimum slope magnitude to classify trend as meaningful.
Interpretation:
Red background: Current asset is trending stronger than the benchmark (positive slope).
Green background: Benchmark is outperforming the current asset (negative slope).
Gray ratio line: Displays the price ratio between current asset and benchmark.
Orange line: Shows the actual slope value over time.
릴리즈 노트
Indicator: Compare Strength (Slope-based)This TradingView indicator compares the relative strength between the current chart asset and a selected benchmark asset. It uses the slope of the log-transformed ratio of the two price series to identify trend bias.
What’s New
We updated the calculation to use math.log(close / benchmark_close) instead of simple division. This log transformation ensures:
Scale invariance across vastly different asset price levels (e.g., BTC vs altcoins)
Symmetrical treatment of upward and downward movements
Smoother slope calculation for better trend sensitivity
Inputs
Symbol: The benchmark asset (e.g., BINANCE:BTCUSDT)
Length: Period used for slope calculation (default: 10)
Multiplier: A scaling factor applied to the log-ratio for better visibility (default: 1000)
Interpretation
Red background: The current asset is stronger than the benchmark (positive slope)
Green background: The current asset is weaker than the benchmark (negative slope)
Flat slope: No clear dominance, trend is neutral
Why Use Log-Ratio + Slope?
Using math.log(price / benchmark) provides a more reliable measure of relative price movement across assets with different nominal values. Applying a slope to this ratio allows us to determine which asset is gaining strength faster.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.