AG Pro Correlation Stress Meter [AGPro Series]AG Pro Correlation Stress Meter
Overview / What it does
AG Pro Correlation Stress Meter is an overlay indicator designed to estimate when an instrument is becoming increasingly synchronized with a selected benchmark and whether that relationship is developing into a higher-stress market condition.
Instead of treating correlation as a standalone number, this script converts multiple correlation-related components into a structured stress framework. The goal is not to predict direction. The goal is to help the user judge whether market behavior is becoming more tightly linked, more fragile, and potentially less independent than usual.
The script combines smoothed rolling correlation, short-term correlation acceleration, persistence of elevated correlation, and a simple fragility layer based on price behavior versus an internal backbone EMA. The result is a normalized stress score and a state model that classifies conditions as Stable, Building, Pressured, Stressed, or Critical.
Because the script is plotted directly on price, it is intended to function as a context layer. It can be used to evaluate whether a chart is trading in a relatively independent manner or whether it is increasingly behaving like a benchmark-driven instrument.
Unique Edge
The main difference in this script is that it does not treat correlation as a single readout. It treats correlation as a pressure structure.
Many correlation tools stop at the raw coefficient. This script goes further by asking four separate questions:
1. How strong is the current relationship?
2. Is that relationship tightening or loosening?
3. Has elevated correlation persisted for long enough to matter?
4. Is price behavior becoming fragile at the same time?
That combination is what makes this script different from many standard overlays, matrix-style correlation displays, or simple coefficient dashboards.
It is also different from several other AG Pro scripts in the catalog. Some AG Pro tools focus on trend quality, pullback quality, squeeze behavior, reclaim structure, momentum pressure, or reaction mapping around known reference levels. This script does not focus on any of those themes. Its job is narrower and more diagnostic: it measures how much benchmark-linked stress is building inside the chart. In other words, it is less about trend or structure classification, and more about whether the instrument is becoming increasingly dependent on external benchmark behavior.
Methodology
The script starts with log returns for both the chart symbol and the selected benchmark symbol. A rolling correlation is then calculated over the chosen correlation window and smoothed to reduce noise.
From there, the model evaluates four components:
1. Correlation strength
This is the normalized level of the smoothed rolling correlation. Higher positive correlation generally contributes more to the final stress score.
2. Correlation velocity
This measures how much the smoothed correlation has changed over a short lookback. A rising relationship can matter even when the absolute coefficient is not yet extreme.
3. Correlation persistence
This evaluates how consistently correlation has remained above a user-defined threshold over a recent window. Short spikes and sustained linkage should not be treated as the same condition, so persistence is included as a separate layer.
4. Fragility layer
This component looks at whether price is trading below the internal backbone EMA, whether short-term rate of change is weak, how stretched price is relative to the EMA, and whether ATR percentage is elevated. The purpose of this layer is not to predict reversals. Its purpose is to distinguish a calm, orderly correlation regime from a more fragile one.
These components are weighted into a composite stress score, then mapped into five states:
- Stable
- Building
- Pressured
- Stressed
- Critical
The script also provides a backdrop layer, optional event labels, a backbone EMA for context, and a compact information panel.
Signals & Alerts
This script is primarily a state-classification and context tool. It is not a direct entry system and should not be interpreted as a standalone buy or sell engine.
Available alert logic includes:
- Stress Building
- Stress Pressured
- Stress Stressed
- Stress Critical
- Stress Cooling
These alerts are designed to notify the user when the internal state model changes. They can be used to monitor regime transitions, benchmark sensitivity changes, or shifts in how tightly a symbol is tracking the selected benchmark.
Practical interpretation examples:
- Building may suggest that correlation-linked influence is starting to develop.
- Pressured may suggest that the relationship is no longer background noise and is becoming relevant to decision-making.
- Stressed may suggest that the symbol is trading with notable benchmark dependency.
- Critical may suggest that benchmark-linked pressure is unusually elevated relative to the script’s internal framework.
- Cooling may suggest that the prior stress state is easing.
These are contextual interpretations, not trade instructions.
Key Inputs
Benchmark Symbol
Selects the reference instrument used for the correlation calculation.
Benchmark Timeframe
Allows the benchmark series to follow the chart timeframe or use a different one.
Correlation Length
Defines the rolling window used for correlation.
Correlation Smoothing
Smooths the raw correlation series.
Velocity Lookback
Controls how quickly changes in correlation are measured.
Persistence Window
Defines how far back the script checks for sustained elevated correlation.
Persistence Threshold
Defines what the script considers “elevated” for persistence purposes.
Fragility EMA Length
Controls the internal backbone EMA used in the fragility layer and optional overlay line.
Fragility ROC Length
Defines the short-term price change measurement inside the fragility model.
ATR Length
Controls the volatility input used in the fragility model.
Label Trigger State
Sets the minimum state required before labels can appear.
Minimum Bars Between Labels
Reduces label clustering.
Background From State
Sets the minimum state required before the stress backdrop is shown.
Label ATR Offset
Controls how far event labels are plotted from price.
Panel / Visual Inputs
Allow control over panel visibility, panel position, panel theme, panel font size, label size, backdrop visibility, backbone visibility, and backbone label visibility.
Limitations & Transparency
This script is a contextual model, not a statement of causality. A high reading does not prove that the benchmark is causing the move. It only indicates that the symbol is trading in a way that is more tightly aligned with the selected benchmark according to the model inputs.
Correlation is also regime-dependent. A symbol may appear highly linked during one period and much less linked during another. Different benchmarks, timeframes, and windows can produce different readings.
The fragility layer is intentionally simple. It is included to refine the stress framework, not to replace full market structure analysis. Users who rely on this script should still examine trend structure, volatility context, liquidity conditions, and the behavior of the benchmark itself.
This script also does not claim to identify tops, bottoms, crashes, breakouts, or future returns. It measures an internal definition of correlation-linked stress and presents that information visually.
Risk Disclosure
This indicator is for analytical and educational use. It does not provide financial advice, investment advice, or guaranteed outcomes.
No indicator can remove market risk. Correlation regimes can change quickly, benchmark relationships can decouple without warning, and any model based on historical data can fail in live conditions.
This tool should be used as one part of a broader chart review process, not as a substitute for independent judgment, risk management, or position sizing discipline.
Wskaźnik Pine Script®




