PROTECTED SOURCE SCRIPT
Tether Dynamics - Statistical Exhaustion Engine

Overview
This strategy detects statistical exhaustion in price movement by modeling price as a particle tethered to a dynamic anchor. When price stretches too far from equilibrium and multiple independent statistical detectors confirm anomalous behavior, the strategy identifies high-probability mean-reversion opportunities.
Unlike simple oversold/overbought indicators, this system fuses concepts from classical mechanics, stochastic filtering, multivariate statistics, and statistical process control into a unified detection framework.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
THEORETICAL FOUNDATION
1. The Tethered Particle Model
The framework draws inspiration from Polyak's heavy ball method in optimization theory, where a particle with momentum navigates a loss landscape. Here, price is modeled as a particle connected to a moving anchor (adaptive EMA) by an elastic "chain" whose length scales with volatility (ATR). This creates a natural physics framework:
This state vector [x, v, a] defines the system's "phase space" — a complete description of price dynamics relative to equilibrium.
2. Adaptive Anchor (Kaufman Efficiency)
The anchor uses an adaptive smoothing approach inspired by Perry Kaufman's Adaptive Moving Average. The Efficiency Ratio measures trend strength:
High efficiency (trending) → faster adaptation
Low efficiency (choppy) → slower, more stable anchor
This prevents whipsaws in ranging markets while staying responsive in trends.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DETECTION ARCHITECTURE
The strategy employs three independent statistical detectors, each grounded in distinct mathematical frameworks. A signal fires when price shows extended tension AND any detector confirms anomalous behavior AND momentum is decelerating (exhaustion).
Detector 1: Mahalanobis Distance (Multivariate Outlier Detection)
The Mahalanobis distance measures how "unusual" the current state vector is, accounting for correlations between displacement, velocity, and acceleration:
Where Σ is the full 3×3 covariance matrix. Under multivariate normality, D² follows a chi-squared distribution with 3 degrees of freedom:
This detector identifies states that are jointly extreme — even if no single variable looks unusual alone.
Why it matters: A price might have moderate displacement and moderate velocity, but the combination could be highly improbable. Mahalanobis captures this multivariate structure that univariate indicators miss.
Detector 2: CUSUM Change-Point Detection
Cumulative Sum (CUSUM) is a sequential analysis technique from statistical process control. It accumulates standardized deviations from the mean:
When either cumulative sum breaches a threshold, a "change point" is detected — the process has shifted from its baseline regime.
Why it matters: CUSUM detects subtle, persistent shifts that might not trigger on any single bar. It's sensitive to regime changes that precede reversals.
Detector 3: Kalman Innovation Filter (Ornstein-Uhlenbeck Model)
This detector models displacement as an Ornstein-Uhlenbeck process — the continuous-time analog of AR(1) mean-reversion:
A Kalman filter tracks the expected displacement and computes the innovation (prediction error):
Under correct model specification, normalized innovations should be ~N(0,1). Large innovations indicate the mean-reversion model is breaking down — price is behaving "unexpectedly" relative to equilibrium dynamics.
Adaptive Q Estimation: The filter continuously adjusts its process noise estimate based on innovation autocorrelation, maintaining calibration across different volatility regimes.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SIGNAL LOGIC
Long Signal Requirements:
Short Signal Requirements:
The deceleration requirement ensures we're catching exhaustion rather than fighting momentum.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
RISK MANAGEMENT
Scale-Out Exit Strategy
Rather than all-or-nothing exits, the strategy takes profits at multiple R-levels:
This locks in gains while allowing winners to run.
Adaptive Trailing Stop
After reaching the activation threshold (default 1R), the stop trails from the highest high (longs) or lowest low (shorts) at a configurable ATR multiple.
Reversal Logic
When an opposite signal fires while in position, the strategy can close and flip direction rather than waiting for a stop-out.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PARAMETER GUIDANCE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
BACKTEST NOTES
Historical testing on NQ (2020-2025) suggests:
Important: Past performance does not guarantee future results. This strategy involves significant risk of loss.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MATHEMATICAL REFERENCES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DISCLAIMER
This strategy is provided for educational and research purposes. Trading futures involves substantial risk of loss. The statistical methods employed do not guarantee profitable outcomes. Always use appropriate position sizing and risk management.
This strategy detects statistical exhaustion in price movement by modeling price as a particle tethered to a dynamic anchor. When price stretches too far from equilibrium and multiple independent statistical detectors confirm anomalous behavior, the strategy identifies high-probability mean-reversion opportunities.
Unlike simple oversold/overbought indicators, this system fuses concepts from classical mechanics, stochastic filtering, multivariate statistics, and statistical process control into a unified detection framework.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
THEORETICAL FOUNDATION
1. The Tethered Particle Model
The framework draws inspiration from Polyak's heavy ball method in optimization theory, where a particle with momentum navigates a loss landscape. Here, price is modeled as a particle connected to a moving anchor (adaptive EMA) by an elastic "chain" whose length scales with volatility (ATR). This creates a natural physics framework:
- Displacement (x): Distance from anchor, normalized by chain length
- Velocity (v): Rate of change of displacement
- Acceleration (a): Rate of change of velocity
This state vector [x, v, a] defines the system's "phase space" — a complete description of price dynamics relative to equilibrium.
2. Adaptive Anchor (Kaufman Efficiency)
The anchor uses an adaptive smoothing approach inspired by Perry Kaufman's Adaptive Moving Average. The Efficiency Ratio measures trend strength:
ER = |Direction| / Volatility = |Price - Price[n]| / Σ|ΔPrice|
High efficiency (trending) → faster adaptation
Low efficiency (choppy) → slower, more stable anchor
This prevents whipsaws in ranging markets while staying responsive in trends.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DETECTION ARCHITECTURE
The strategy employs three independent statistical detectors, each grounded in distinct mathematical frameworks. A signal fires when price shows extended tension AND any detector confirms anomalous behavior AND momentum is decelerating (exhaustion).
Detector 1: Mahalanobis Distance (Multivariate Outlier Detection)
The Mahalanobis distance measures how "unusual" the current state vector is, accounting for correlations between displacement, velocity, and acceleration:
D² = (x - μ)ᵀ Σ⁻¹ (x - μ)
Where Σ is the full 3×3 covariance matrix. Under multivariate normality, D² follows a chi-squared distribution with 3 degrees of freedom:
- χ²(3, 0.90) = 6.25 → 10% of observations exceed this
- χ²(3, 0.95) = 7.81 → 5% of observations exceed this
This detector identifies states that are jointly extreme — even if no single variable looks unusual alone.
Why it matters: A price might have moderate displacement and moderate velocity, but the combination could be highly improbable. Mahalanobis captures this multivariate structure that univariate indicators miss.
Detector 2: CUSUM Change-Point Detection
Cumulative Sum (CUSUM) is a sequential analysis technique from statistical process control. It accumulates standardized deviations from the mean:
S⁺ₜ = max(0, S⁺ₜ₋₁ + zₜ - drift)
S⁻ₜ = min(0, S⁻ₜ₋₁ + zₜ + drift)
When either cumulative sum breaches a threshold, a "change point" is detected — the process has shifted from its baseline regime.
Why it matters: CUSUM detects subtle, persistent shifts that might not trigger on any single bar. It's sensitive to regime changes that precede reversals.
Detector 3: Kalman Innovation Filter (Ornstein-Uhlenbeck Model)
This detector models displacement as an Ornstein-Uhlenbeck process — the continuous-time analog of AR(1) mean-reversion:
dx = θ(μ - x)dt + σdW
A Kalman filter tracks the expected displacement and computes the innovation (prediction error):
νₜ = (yₜ - x̂ₜ|ₜ₋₁) / √Sₜ
Under correct model specification, normalized innovations should be ~N(0,1). Large innovations indicate the mean-reversion model is breaking down — price is behaving "unexpectedly" relative to equilibrium dynamics.
Adaptive Q Estimation: The filter continuously adjusts its process noise estimate based on innovation autocorrelation, maintaining calibration across different volatility regimes.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SIGNAL LOGIC
Long Signal Requirements:
- Z-Displacement < -σ threshold (price stretched below anchor)
- ANY detector fires (Mahalanobis outlier OR CUSUM change OR Kalman innovation < -2σ)
- Z-Acceleration > 0 (downward momentum decelerating)
Short Signal Requirements:
- Z-Displacement > +σ threshold (price stretched above anchor)
- ANY detector fires
- Z-Acceleration < 0 (upward momentum decelerating)
The deceleration requirement ensures we're catching exhaustion rather than fighting momentum.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
RISK MANAGEMENT
Scale-Out Exit Strategy
Rather than all-or-nothing exits, the strategy takes profits at multiple R-levels:
- Scale 1: 20% at 0.5R
- Scale 2: 20% at 1.0R
- Scale 3: 10% at 1.5R (optional)
- Remainder: Trailing stop
This locks in gains while allowing winners to run.
Adaptive Trailing Stop
After reaching the activation threshold (default 1R), the stop trails from the highest high (longs) or lowest low (shorts) at a configurable ATR multiple.
Reversal Logic
When an opposite signal fires while in position, the strategy can close and flip direction rather than waiting for a stop-out.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PARAMETER GUIDANCE
- Anchor Period (24): Base period for adaptive anchor
- ATR Period (14): Volatility measurement
- Chain Length Mult (2.5): Tether elasticity — higher = more stretch allowed
- Long Tension σ (1.5): Lower = more signals
- Short Tension σ (2.0): Higher threshold for shorts (trend asymmetry)
- Mahalanobis Threshold (6.25): χ²(3, 0.90) — adjust for signal frequency
- CUSUM Threshold (3.0): Lower = more sensitive to regime shifts
- Lookback Window (100): Statistical estimation window
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
BACKTEST NOTES
Historical testing on NQ (2020-2025) suggests:
- Long signals show stronger edge than shorts in equity indices
- 1H and 30-min timeframes balance signal quality vs. frequency
- "Long Only" mode recommended for equity index futures
Important: Past performance does not guarantee future results. This strategy involves significant risk of loss.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MATHEMATICAL REFERENCES
- Polyak, B.T. (1964). "Some methods of speeding up the convergence of iteration methods" (Heavy ball method)
- Bertsekas, D.P. (1999). "Nonlinear Programming" (Heavy ball method / momentum dynamics)
- Mahalanobis, P.C. (1936). "On the generalized distance in statistics"
- Page, E.S. (1954). "Continuous inspection schemes" (CUSUM)
- Kalman, R.E. (1960). "A new approach to linear filtering and prediction problems"
- Uhlenbeck, G.E. & Ornstein, L.S. (1930). "On the theory of Brownian motion"
- Kaufman, P. (1995). "Smarter Trading" (Adaptive Moving Average)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DISCLAIMER
This strategy is provided for educational and research purposes. Trading futures involves substantial risk of loss. The statistical methods employed do not guarantee profitable outcomes. Always use appropriate position sizing and risk management.
Skrip terproteksi
Skrip ini diterbitkan sebagai sumber tertutup. Namun, Anda dapat menggunakannya dengan bebas dan tanpa batasan apa pun – pelajari lebih lanjut di sini.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip terproteksi
Skrip ini diterbitkan sebagai sumber tertutup. Namun, Anda dapat menggunakannya dengan bebas dan tanpa batasan apa pun – pelajari lebih lanjut di sini.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.