OPEN-SOURCE SCRIPT
Relative Strength vs S&P 500 (SPX/ES)

Relative Strength vs S&P 500
This indicator measures the relative performance of an asset compared to the S&P 500, helping traders and investors identify whether an asset is outperforming or underperforming the broader market.
The calculation is based on a price ratio between the selected asset and the S&P 500, optionally normalized to a base value (100) for easier interpretation.
How to read it:
Above the baseline (100) → the asset is outperforming the S&P 500
Below the baseline (100) → the asset is underperforming the S&P 500
Rising line → strengthening relative performance
Falling line → weakening relative performance
Why it’s useful:
Helps focus on market leaders, not just assets that “look cheap”
Filters trades and investments in the direction of relative strength
Useful for swing trading, long-term investing, and portfolio allocation
Widely used in institutional and professional asset management
This indicator is best used as a trend and selection filter, in combination with technical setups (support/resistance, VWAP, structure).
This indicator measures the relative performance of an asset compared to the S&P 500, helping traders and investors identify whether an asset is outperforming or underperforming the broader market.
The calculation is based on a price ratio between the selected asset and the S&P 500, optionally normalized to a base value (100) for easier interpretation.
How to read it:
Above the baseline (100) → the asset is outperforming the S&P 500
Below the baseline (100) → the asset is underperforming the S&P 500
Rising line → strengthening relative performance
Falling line → weakening relative performance
Why it’s useful:
Helps focus on market leaders, not just assets that “look cheap”
Filters trades and investments in the direction of relative strength
Useful for swing trading, long-term investing, and portfolio allocation
Widely used in institutional and professional asset management
This indicator is best used as a trend and selection filter, in combination with technical setups (support/resistance, VWAP, structure).
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน