OPEN-SOURCE SCRIPT

Relative Strength Leadership Engine (Open Source)

44
Relative Strength Leadership Engine (Open Source)

The Relative Strength Leadership Engine is a context-first indicator designed to evaluate whether a symbol is behaving like a market leader relative to a benchmark index (default: SPY).

Instead of producing trade signals, this tool answers a higher-level question:

Is relative strength leadership present — and is the broader market environment supportive right now?

Leadership is expressed through permission states (FULL / CAUTION / BLOCKED), accompanied by clear, deterministic diagnostics that explain why leadership is permitted or denied.

What Makes This Tool Different

Most relative strength indicators focus on a single dimension (RS line, ratio, or new-high detection).
This engine evaluates leadership across multiple independent layers, including:

Relative strength vs a benchmark baseline

Volatility-normalized RS momentum

Proximity to relative strength highs and leadership freshness

Multi-horizon confirmation (daily / weekly / monthly)

Optional benchmark timing filter (risk-on vs risk-off context)

Leadership is granted only when multiple conditions align, and denied when evidence weakens.

Permission-Based Output (Not Signals)

This indicator does not generate entries, exits, or trade recommendations.

Instead, it provides leadership permission states:

ENGAGE — leadership conditions are supportive

OBSERVE / WAIT — leadership exists but timing or quality is degraded

STAND DOWN — leadership is broken or unsupported

When leadership is permitted, the panel confirms that all required conditions are supportive.
When leadership is denied, the primary failure is explicitly identified.

How to Use

This tool is intended for upstream decision-making, such as:

Filtering leadership candidates before applying setups

Monitoring leadership quality and aging

Avoiding forced participation during unfavorable market conditions

Adding regime and participation context to discretionary or systematic workflows

Permission is fail-closed by design and only granted when evidence supports it.

Alerts (Informational Only)

Optional alerts notify users of state transitions (e.g., leadership entering FULL or CAUTION), relative strength new highs, or momentum re-acceleration events.

All alerts are descriptive and informational, not trading instructions.

Important Notes

Indicator only — no orders, no trade execution

No repaint or lookahead logic

Educational and informational use only — not financial advice

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.