PROTECTED SOURCE SCRIPT
Performance Diff vs Benchmark (Visible Range)

Performance Difference vs Benchmark (Visible Range)
This indicator compares the relative performance of the current asset against a benchmark (e.g. SPY) only within the currently visible chart range.
Instead of using a fixed historical anchor, the calculation automatically resets when you zoom or scroll the chart, always using the first visible bar as the starting point.
How it works
The indicator retrieves the benchmark price using the same timeframe as the chart.
When the visible range changes, both the asset and the benchmark are re-anchored to their first visible close.
It then calculates:
- Asset performance (%)
- Benchmark performance (%)
- Performance difference = Asset – Benchmark
The result is shown only inside the visible window.
Visual interpretation
- Green area above 0 → the asset is outperforming the benchmark
- Red area below 0 → the asset is underperforming the benchmark
- The zero line represents equal performance.
A label on the right edge of the chart displays the current performance difference in %.
Why this is useful
Instantly measure relative strength without manual anchors
Ideal for:
Sector vs index comparison
Stock vs ETF analysis
Pair trading & relative momentum
Works naturally with zooming, scrolling, and multi-timeframe analysis
Inputs
Benchmark symbol (selectable from the indicator settings)
Notes
The indicator is designed for visual, comparative analysis, not absolute performance tracking.
Results update dynamically based on what is currently visible on the chart.
This indicator compares the relative performance of the current asset against a benchmark (e.g. SPY) only within the currently visible chart range.
Instead of using a fixed historical anchor, the calculation automatically resets when you zoom or scroll the chart, always using the first visible bar as the starting point.
How it works
The indicator retrieves the benchmark price using the same timeframe as the chart.
When the visible range changes, both the asset and the benchmark are re-anchored to their first visible close.
It then calculates:
- Asset performance (%)
- Benchmark performance (%)
- Performance difference = Asset – Benchmark
The result is shown only inside the visible window.
Visual interpretation
- Green area above 0 → the asset is outperforming the benchmark
- Red area below 0 → the asset is underperforming the benchmark
- The zero line represents equal performance.
A label on the right edge of the chart displays the current performance difference in %.
Why this is useful
Instantly measure relative strength without manual anchors
Ideal for:
Sector vs index comparison
Stock vs ETF analysis
Pair trading & relative momentum
Works naturally with zooming, scrolling, and multi-timeframe analysis
Inputs
Benchmark symbol (selectable from the indicator settings)
Notes
The indicator is designed for visual, comparative analysis, not absolute performance tracking.
Results update dynamically based on what is currently visible on the chart.
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 ただし、制限なく自由に使用できます – 詳細はこちらでご確認ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 ただし、制限なく自由に使用できます – 詳細はこちらでご確認ください。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。