OPEN-SOURCE SCRIPT
Outperformance Alpha

Outperformance Alpha
Relative Strength Engine – Alpha vs Benchmark
This indicator calculates the rolling outperformance (alpha) of any symbol against a chosen benchmark and displays it in a separate pane. It offers both a simple excess-return mode and a full risk-adjusted (Jensen-style) alpha that incorporates rolling beta and a risk-free rate.
Default benchmark is set to CNX500.
You can change it to any index or stock.
What the Indicator Shows
• Continuous alpha line with color-coded fill (positive = teal, negative = red)
• Automatic detection of short-term alpha peaks (selectable 9 / 21 / 50 bars)
• 52-week alpha highs
• Special “Alpha Leads Price” signal (cyan diamonds) – appears when alpha makes a
new 52-week high while the stock price itself has not yet broken its own 52-week
high
• Optional soft background coloring based on alpha direction
• Real-time statistics table (Alpha, Stock Return, Benchmark Return, Beta, Risk-Free
Rate)
Calculation Modes:
1.Simple Excess Return
Stock return over the chosen period minus benchmark return.
2.Risk-Adjusted
Classic Jensen’s Alpha using rolling beta and a user-defined annual risk-free
rate(periodized automatically).
Key Inputs:
1.Benchmark symbol (default: CNX500)
2.Performance lookback period
3.Alpha calculation mode
4.Risk-free rate (annual %)
5.Beta calculation window
6.Short-term peak length
7.Toggle for the early “Alpha Leads Price” diamonds
8.Full color and display controls
Alerts Included:
• Alpha crosses above zero
• Alpha crosses below zero
• New 52-week alpha high
• Alpha Leads Price signal
Recommended Usage:
Works best on the daily timeframe. All length inputs are measured in bars.
Use it as a relative-strength filter to identify stocks that are genuinely outperforming (or underperforming) their benchmark, especially when the cyan “Alpha Leads Price” diamonds appear.
Disclaimer:
This tool is for educational and informational purposes only. It does not provide investment advice. Past relative performance is not a guarantee of future results. Always do your own research and risk management.
Relative Strength Engine – Alpha vs Benchmark
This indicator calculates the rolling outperformance (alpha) of any symbol against a chosen benchmark and displays it in a separate pane. It offers both a simple excess-return mode and a full risk-adjusted (Jensen-style) alpha that incorporates rolling beta and a risk-free rate.
Default benchmark is set to CNX500.
You can change it to any index or stock.
What the Indicator Shows
• Continuous alpha line with color-coded fill (positive = teal, negative = red)
• Automatic detection of short-term alpha peaks (selectable 9 / 21 / 50 bars)
• 52-week alpha highs
• Special “Alpha Leads Price” signal (cyan diamonds) – appears when alpha makes a
new 52-week high while the stock price itself has not yet broken its own 52-week
high
• Optional soft background coloring based on alpha direction
• Real-time statistics table (Alpha, Stock Return, Benchmark Return, Beta, Risk-Free
Rate)
Calculation Modes:
1.Simple Excess Return
Stock return over the chosen period minus benchmark return.
2.Risk-Adjusted
Classic Jensen’s Alpha using rolling beta and a user-defined annual risk-free
rate(periodized automatically).
Key Inputs:
1.Benchmark symbol (default: CNX500)
2.Performance lookback period
3.Alpha calculation mode
4.Risk-free rate (annual %)
5.Beta calculation window
6.Short-term peak length
7.Toggle for the early “Alpha Leads Price” diamonds
8.Full color and display controls
Alerts Included:
• Alpha crosses above zero
• Alpha crosses below zero
• New 52-week alpha high
• Alpha Leads Price signal
Recommended Usage:
Works best on the daily timeframe. All length inputs are measured in bars.
Use it as a relative-strength filter to identify stocks that are genuinely outperforming (or underperforming) their benchmark, especially when the cyan “Alpha Leads Price” diamonds appear.
Disclaimer:
This tool is for educational and informational purposes only. It does not provide investment advice. Past relative performance is not a guarantee of future results. Always do your own research and risk management.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน