AG Pro Relative Strength Rotation Map [AGPro Series]AG Pro Relative Strength Rotation Map
OVERVIEW / WHAT IT DOES
AG Pro Relative Strength Rotation Map is a relative leadership framework designed to evaluate how the active symbol is behaving versus a user-defined reference symbol. Instead of focusing only on absolute price movement, this script studies whether the active market is strengthening, weakening, stabilizing, or rotating relative to its benchmark.
The script builds a smoothed relative-strength backbone, measures rotation pressure through fast-versus-slow internal comparison, and classifies the current environment into clear structural states. The goal is not to predict future price, but to help the user read whether relative leadership is improving, fading, or losing quality.
This makes the script useful when the question is not simply “is price going up or down?” but rather:
- Is this symbol outperforming or underperforming a chosen benchmark?
- Is leadership gaining traction or fading?
- Is the current rotation constructive, weak, or at risk of deterioration?
Because of that, the script can be used across multiple workflows, including:
- crypto asset vs BTC or another reference asset
- stock vs index benchmark
- sector ETF vs broader market ETF
- instrument vs instrument relative comparison
UNIQUE EDGE
This script is not a simple ratio line, not a screener, and not a classic momentum oscillator.
Its main distinction is that it separates relative-strength behavior into a structured rotation model built from:
- relative-strength bias
- rotation pressure
- persistence
- state transitions
In other words, it does not stop at showing whether one asset is stronger than another. It also attempts to show whether that leadership is building, stable, fading, or structurally vulnerable.
Compared with many standard relative-strength tools, this script is designed to be more state-driven and map-oriented rather than just line-oriented.
Compared with other AG Pro scripts, this one addresses a different problem set:
- it does not grade breakout quality
- it does not analyze reclaim behavior around a single moving average or level
- it does not map exhaustion or pressure inside one symbol in isolation
- it does not classify broad market regime
- it does not function as a multi-symbol screener
Instead, it focuses on one specific task:
reading relative leadership rotation between the active chart and a chosen benchmark.
That makes it structurally different from the rest of the AG Pro catalog and useful as a complementary layer rather than an overlapping one.
METHODOLOGY
The script starts by building a relative-strength ratio between the active symbol and the selected reference symbol. That ratio is then normalized around its own baseline and smoothed into an RS backbone so that the user can observe directional leadership more clearly.
A rotation-pressure engine is then derived from the relationship between faster and slower internal measures of that backbone. This helps estimate whether relative movement is gaining traction, losing traction, or transitioning.
A persistence component is also included so short-lived fluctuations are not treated the same way as more durable relative-strength behavior.
Using those building blocks, the script classifies market structure into states such as:
- Leadership Rising
- Leadership Stable
- Rotation Building
- Leadership Fading
- Breakdown Risk
- Neutral / Mixed
This is intended as a decision-support framework for context reading, not a standalone execution model.
SIGNALS & ALERTS
The script can mark structural events such as:
- Leadership Reclaim
- Rotation Build
- Leadership Fade
- Breakdown Risk Rising
- State Changed
These events are derived from the internal relative-strength and rotation conditions of the model. They are intended to help the user notice structural changes in leadership behavior, not to serve as guaranteed entry or exit instructions.
KEY INPUTS
Important controls include:
- Reference Symbol
- Timeframe source selection
- RS Baseline Length
- Backbone Smoothing
- Pressure Fast Length
- Pressure Slow Length
- Threshold Length
- Persistence Length
- Signal Sensitivity
- Zone visibility
- Histogram visibility
- Event label visibility
- Panel position and style controls
These inputs allow the user to adapt the script to different symbols, volatility profiles, and chart-reading preferences.
LIMITATIONS & TRANSPARENCY
This script does not measure intrinsic value, fundamentals, liquidity quality, or macro context. It only evaluates relative-strength behavior through its own internal model.
Like any state-based framework, it can produce transitions that later reverse, especially in noisy or low-conviction market conditions. Relative-strength leadership can also change quickly when the benchmark itself becomes unstable or when both assets move in the same direction with changing intensity.
This script should therefore be used as a contextual and comparative tool, not as a promise of continuation, reversal, or future performance.
It is also important to understand what this script is not:
- not a prediction engine
- not a full portfolio allocator
- not a complete trading system
- not a substitute for confirmation, risk management, or broader market context
RISK DISCLOSURE
This script is for chart analysis and research support only. It does not provide financial, investment, legal, or tax advice. Markets involve risk, and no indicator can guarantee performance or prevent loss. Decisions involving real capital should be made only with appropriate risk controls and independent judgment.
Indicator

SMT Divergence Strength Index [Metrify]This indicator detects SMT-style divergence between the chart symbol and a user-defined reference symbol, then filters those divergence events using a statistical strength condition. The goal is to separate ordinary pivot mismatches from divergence events that occur during unusually large relative movement between the two instruments.
It combines three components in one script: pivot-based divergence detection, Z-score normalization of momentum spread, and a correlation plot for context. The output is an oscillator panel (Z-score columns + correlation line) plus optional SMT labels/lines drawn on the main chart.
SMT divergence logic (structural layer)
The structural part of the script is based on confirmed pivots on the main symbol.
For bearish SMT detection, the script checks whether the main symbol forms a higher high while the reference symbol (evaluated at the same pivot event point) forms a lower high relative to the previous corresponding pivot event. For bullish SMT detection, it checks whether the main symbol forms a lower low while the reference symbol forms a higher low
Reference symbol and inversion
The Reference Symbol (Pairing) input defines the market used for comparison. The usefulness of the divergence output depends heavily on this pairing. The script assumes the comparison is meaningful enough that non-confirmation between the two symbols can be interpreted as a potential imbalance or relative weakness/strength event.
The 'Invert Correlation' option transforms the reference data by using reciprocal values before the divergence and correlation calculations. This can be used when analyzing pairs that are expected to move inversely (like alt to btc in specific event), so the comparison orientation better matches the intended relationship.
Invert Correlation mode (what it does and why it exists)
The Invert Correlation option changes how the reference symbol is transformed before all downstream calculations (pivot comparison, momentum spread, Z-score, and correlation plot). When enabled, the script does not compare the main symbol to the raw reference prices. Instead, it compares against the reciprocal form of the reference series:
reference high is transformed using 1 / low
reference low is transformed using 1 / high
reference close is transformed using 1 / close
This inversion is used so that an inversely related market can be analyzed in the same directional framework as a positively correlated one. In practical terms, it converts an opposite direction relationship into a comparable orientation for SMT logic. After inversion, moves that would normally appear opposite can be interpreted as if they were aligned, allowing the same higher-high / lower-high and lower-low / higher-low SMT structure rules to be applied consistently.
Conceptually, invert mode is useful when your reference asset is expected to move opposite to the main asset and you want the script to evaluate non-confirmation in a unified SMT framework. It does not automatically improve signal quality, but simply changes the orientation of the comparison so the divergence logic matches the relationship you are trying to study.
Use normal mode when the pair is usually expected to move in the same direction.
Use invert mode when the pair is usually expected to move in opposite directions (or when your analysis framework treats one as a risk-off mirror of the other).
Good inversion-pair examples (practical)
1) Risk asset vs Dollar Index (DXY)
This is one of the cleanest concepts for inversion.
BTCUSD vs DXY
ETHUSD vs DXY
OIL VS DXY
NASDAQ (NDX / US100) vs DXY
Gold vs DXY (often inverse, but can break regime)
When DXY rises, risk assets often weaken. Inverting DXY makes the reference move in the same orientation as the risk asset.
2) Equity index vs VIX
Very common inverse relationship idea.
SPX / ES / NQ vs VIX
BTC (sometimes) vs VIX as a broader risk proxy (less direct, more regime dependent)
Why inversion helps: VIX is typically "fear up when equities down". Inverted VIX can be used as a proxy for risk-on alignment.
3) USD-quoted asset vs USD strength proxy
If your main symbol is sensitive to USD strength:
XAUUSD vs DXY
EURUSD vs DXY
GBPUSD vs DXY
AUDUSD vs DXY
These are classic macro pairings where inversion often makes analytical sense.
4) Some commodity currencies vs commodity / dollar drivers (case-by-case)
Examples can work, but are more conditional:
USDCAD vs Oil (WTI) (often inverse-ish relationship via CAD/oil linkage)
AUDUSD vs Copper (sometimes)
NZDUSD vs risk proxy
These are not as stable as DXY/VIX examples, so you need to monitor correlation more carefully.
Trigger conditions in plain terms
A bearish SMT label appears only when all required conditions are satisfied:
a confirmed pivot high exists on the main symbol,
the current main pivot high is higher than the previous main pivot high,
the aligned reference high at the same pivot event is lower than its previous aligned reference high,
and the Z-score condition exceeds the configured threshold.
A bullish SMT label follows the mirrored condition/vice versa.
Display behavior and non-repaint option
The indicator uses confirmed pivots, so signals are known only after pivot confirmation. The Non repaint mode setting controls how labels are displayed:
Enabled: labels are shown on the trigger/confirmation bar (the bar where the pivot is confirmed and the signal becomes true).
Disabled: labels are shifted back to the pivot bar for visual alignment.
This setting affects visualization only. It does not change the underlying pivot confirmation process.
This indicator marks pivot-based intermarket non-confirmation events that occur during statistically elevated relative dislocation.
Pair selection remains a major source of variation in output quality. Weakly related pairs can produce divergence labels that satisfy the script’s rules but are not analytically useful. Indicator

Relative Strength Regime Meter (SPY/QQQ/Peer Auto)RS Dash v2 is a relative strength (RS) dashboard designed to quickly answer one question:
Is this asset leading or lagging vs (1) the market, (2) Nasdaq/growth, and (3) its peer group?
What it measures
For the current chart symbol, it calculates RS ratios:
RS vs SPY (market baseline)
RS vs QQQ (Nasdaq / growth baseline)
RS vs PEER ETF (sector/industry baseline)
RS ratio is simply:
RS = Symbol Close / Benchmark Close
Then it compares each RS ratio to its moving average (MA):
✅ if RS > RS_MA
Optional stricter rule: ✅ only if RS > RS_MA and RS_MA is rising
Peer ETF: Manual or Auto
You can pick the peer ETF in two ways:
MANUAL mode
Choose from labeled options like:
XLK – TECH, XLE – ENERGY, SMH – SEMIS, etc.
AUTO mode (default)
The script selects the peer ETF whose returns have the highest correlation to the symbol over a lookback window, with guardrails:
Min correlation threshold: if correlation is too low, it falls back to your chosen fallback peer.
Sticky switching: it only changes peer when the new best peer is better by a set margin (reduces “flicker”).
The table shows what AUTO picked, and it also prints the correlation as a trust meter.
Dashboard + Score
A table (bottom-left) shows:
SPY ✅/❌
QQQ ✅/❌
PEER ✅/❌ (with chosen peer name)
Total score 0–3
Interpretation:
3/3 = strong leadership (outperforming market + Nasdaq + peers)
2/3 = mixed leadership
0–1/3 = weak / lagging regime
Plot modes (solves scaling issues)
Because raw RS ratios can be on very different numeric scales, there are three plot modes:
Signal (% vs RS MA) (recommended)
Plots each RS as % above/below its RS MA where 0 = neutral.
Indexed (Base 100)
Normalizes each RS to start at 100 so you can compare “performance curves.”
Raw (single)
Shows only one RS ratio at a time (SPY / QQQ / PEER) for inspection.
Leadership line (Regime meter)
The Leadership line is a step line that visualizes the 0–3 score as a regime meter (it only has 4 states, by design). It helps you spot regime shifts without reading the table.
Divergences (optional)
Optional bullish/bearish divergence markers compare price pivots vs RS pivots on your chosen benchmark (SPY/QQQ/PEER). These are confirmation tools, not signals by themselves.
What this indicator is NOT
It does not predict tops/bottoms.
It does not replace fundamentals or risk management.
“AUTO peer” is correlation-based; in unusual regimes it can pick a peer that’s statistically close but not conceptually perfect — override with MANUAL when needed.
Suggested workflow
Keep plot mode on Signal (% vs RS MA)
Use AUTO peer for speed; flip to MANUAL if the chosen peer doesn’t make sense.
Use score changes + divergences as context, then use your main price/volume system for entries/exits.
Open-source, modify as you like.
Shorter description
RS Dash v2 compares the current symbol’s relative strength vs SPY, QQQ, and a Peer ETF (manual or auto-selected).
Each benchmark gets a ✅/❌ based on whether RS > RS_MA (optional: MA rising). The dashboard shows a 0–3 score and a Leadership step line that visualizes regime shifts.
Includes 3 plot modes to fix scaling: Signal (% vs MA), Indexed Base 100, and Raw single. Optional RS divergences.
Settings explanation
RS MA length: smoothing for RS trend. Higher = slower, fewer flips.
Auto return length / correlation lookback: controls how AUTO chooses the peer. Higher = more stable but slower to adapt.
Min corr / switch delta: guardrails to prevent nonsense picks and rapid switching.
Plot mode: choose Signal for decision clarity, Indexed for comparison curves, Raw for inspection.
Blunt “professional honesty” note
Correlation-based peer selection is a statistical best guess, not a fundamental sector classifier. That’s why the indicator is transparent: it shows the selected peer and correlation so users can override. Indicator

Indicator

Indicator

Indicator

Correlation Coefficient: Visible Range Dynamic Average R -Correlation Coefficient with Dynamic Average R (shows R average for the visible chart only, changes as you zoom in or out)
-Label: Vis-Avg-R = Visable Average R
-the Correlation Coefficient function for Pearson's R is taken from "BA🐷 CC" indicator by @balipour (highly recommended; more thorough treatment of R and other stats, but without the dynamic average)
-I wrote this primarily to add a dynamic Average R, showing correlation for arbitrary start times/end times; whether it be the last month, last year, of some specific period from the past (backtest mode)
-I have been using this to get an idea of correlation regimes over time between Bonds vs Stocks (ZB1! vs ES1!).
-As you see from the above, most of 2022 has seen an unusually strong positive correlation between Bonds and Stocks
~~inputs:
-lookback length for calculation of R
-Backtest mode (true by default): displays Average R for ONLY the visible range displayed on any part of chart history (LHS to RHS of screen only)
-source for both Ticker and compared Asset (close, open, high, low, ohlc4.. etc)
~~some other assets worth comparing:
Aussie vs Gold; Aussie vs ES; Btc vs ES; Copper vs ES
Indicator

Indicator

Comparative Strength [FT]This indicator calculates the comparative strength between 2 variables by subtracting them instead of division/ratio.
Example:
A is stronger than B, then if A-B, it would be positive because value A is bigger than B.
A is weaker than B, then when A-B, this would be negative because A is lower than B.
What it does:
It takes the difference of averages of variable A (ie: stock), and the same for variable B (ie: index), and then the result of those is substracted to get a value.
Why is this indicator useful ?
To visualise comparative values between 2 related variables. IE: stock-index, stock-commodities, forex-interest rates, forex-bond, forex-inflation.
DISCLAIMER: Nothing in this content should be interpreted as financial advice or a recommendation to buy or sell any sort of security, investment, currencies or assets. Indicator

Indicator

Relative Strength(RSMK) + Perks - Markos KatsanosIf you are desperately looking for a novel RSI, this isn't that. This is another lesser known novel species of indicator. Hot off the press, in multiple stunning color schemes, I present my version of "Relative Strength (RSMK)" employing PSv4.0, originally formulated by Markos Katsanos for TASC - March 2020 Traders Tips. This indicator is used to compare performance of an asset to a market index of your choosing. I included the S&P 500 index along side the Dow Jones and the NASDAQ indices selectively by an input() in "Settings". You may comparatively analyze other global market indices by adapting the code, if you are skilled enough in Pine to do so.
With this contribution to the Tradingview community, also included is MY twin algorithmic formulation of "Comparative Relative Strength" as a supplementary companion indicator. They are eerily similar, so I decided to include it. You may easily disable my algorithm within the indicator "Settings". I do hope you may find both of them useful. Configurations are displayed above in multiple scenarios that should be suitable for most traders.
As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette". For those of you who are newcomers to Pine Script, this script may also help you understand advanced programming techniques in Pine and how they may be utilized in a most effective manner. Utilizing the "Power of Pine", I included the maximum amount of features I could surmise in an ultra small yet powerful package, being less than a 60 line implementation at initial release.
Unfortunately, there are so many Pine mastery techniques included, I don't have time to write about all of them. I will have to let you discover them for yourself, excluding the following Pine "Tricks and Tips" described next. Of notable mention with this release, I have "overwritten" the Pine built-in function ema(). You may overwrite other built-in functions too. If you weren't aware of this Pine capability, you now know! Just heed caution when doing so to ensure your replacement algorithms are 100% sound. My ema() will also accept a floating point number for the period having ultimate adjustability. Yep, you heard all of that properly. Pine is becoming more impressive than `impressive` was originally thought of...
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND much, much more... You have the source!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone! Indicator

Strategy

Indicator

Indicator

Indicator
