PROTECTED SOURCE SCRIPT

IBD Style RS Rating Line Indicator

69
Purpose

  • Measures relative performance, not just price action.
  • Recreates the IBD-style 1–99 RS Rating inside TradingView.


RS Line

  • Plots stock price relative to a benchmark (default: SPX).
  • Scaled for readability; supports indices and sectors.
  • Optional MA overlays and positive/negative fill zones.


RS New Highs / New Lows

  • Scans a user-defined lookback.
  • Marks RS new highs (blue) and new lows (red).
  • Modes for historical, last-bar-only, or “RS leads price.”


RS Rating (1–99)

  • Calculates a weighted performance score over 1–12 months.
  • Compares this score to market-wide thresholds pulled via request.seed().
  • Converts score into percentile bands (e.g., 70–89, 90–98).
  • Assigns 99 to top leaders and 1 to laggards.


Fallback Logic

  • Missing environment data = shows “RS” without a number.
  • Replay mode uses fixed thresholds to approximate ratings.


Output

  • Clean label showing RS Rating near the RS line.
  • Helps traders instantly judge whether a stock is a true leader.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.