Ornstein Uhlenbeck Elastic Tension Meter MT4
- 지표
-
Anthony Cooke
Quantitative Systems Architect and C++, Python, MQL5, MQL4, and Pine Script developer specializing in non-repainting mathematical indicators, Expert Advisors, and statistical strategy audits. I combine industrial quality-control engineering and Applied Mathematics with multi-physics market modeling - 버전: 1.0
OVERVIEW AND SCIENTIFIC ORIGIN
The OU Elastic Tension Meter is a standalone quantitative mean-reversion oscillator engineered from Stochastic Physics and the Ornstein-Uhlenbeck (OU) Mean-Reversion Process: dX_t = theta * (mu - X_t)dt + sigma * dW_t. Originally formulated in statistical physics to describe how particles moving through a resistive medium are pulled back toward an equilibrium anchor, the Ornstein-Uhlenbeck framework is widely applied in quantitative finance to model elastic price displacement and statistical snap-back tension.
Designed as a complete, unrestricted technical oscillator with strictly causal, non-repainting calculation, this indicator measures exact structural price stretch in multiples of Average True Range (ATR) so overextension levels remain mathematically consistent across Forex pairs, Gold (XAUUSD), Silver (XAGUSD), and Indices without requiring manual pip recalibration.
MATHEMATICAL MECHANISM
Raw distance from a moving average measured in pips or points cannot be compared across different assets or changing volatility sessions. This indicator normalizes displacement directly against live rolling volatility across a configurable equilibrium window (InpPeriod = 55):
- Elastic Tension Formula: Tension = (Close - SMA(55)) / ATR(55). Expressing price distance from the 55-bar Simple Moving Average in units of 55-bar Average True Range converts raw price moves into a dimensionless elastic stretch score.
- Smooth Signal Curve: An 8-period Exponential Moving Average (InpSignalPeriod = 8) smooths the tension histogram into a continuous Gold momentum curve so traders can identify when extreme stretch begins curling back toward equilibrium.
VISUAL GUIDE AND LIVE TELEMETRY HUD
Subwindow Scale (-5.5 to +5.5, with dashed horizontal levels at +2.5, 0.0, and -2.5 ATR):
- Teal Histogram (Bull_Normal_Stretch): Standard bullish expansion between 0.0 and +2.5 ATR.
- Aqua Bold Histogram (Bull_Extreme_Snap): Overextended upper elastic snap-back zone at or above +2.5 ATR.
- FireBrick Histogram (Bear_Normal_Stretch): Standard bearish expansion between 0.0 and -2.5 ATR.
- OrangeRed Bold Histogram (Bear_Extreme_Snap): Overextended lower elastic snap-back zone at or below -2.5 ATR.
- Gold Smooth Line (OU_Signal_Curve): 8-period EMA tension momentum line for tracking turn confirmation.
Upper-Right Live Telemetry HUD (InpShowHUD = true):
- Line 1 (OU ELASTIC TENSION): Displays live ATR stretch with sign and active zone classification (UPPER SNAP ZONE, LOWER SNAP ZONE, BULL STRETCH, BEAR STRETCH, or EQUILIBRIUM ZONE).
- Line 2 (EQUILIBRIUM DETAILS): Displays the exact rolling SMA(55) equilibrium price, live distance from equilibrium in broker points (DIST), and live 55-bar ATR in points.
PRACTICAL USAGE
Upper Snap-Back Zone (+2.5 ATR and Above):
When histogram bars shift from Teal into bold Aqua above the +2.5 level and the HUD reads UPPER SNAP ZONE, price is statistically stretched well above its equilibrium anchor. Mean-reversion traders watch for Aqua bars to shrink and cross back beneath the Gold OU_Signal_Curve as early confirmation of a pullback toward the SMA(55).
Lower Snap-Back Zone (-2.5 ATR and Below):
When histogram bars shift from FireBrick into bold OrangeRed below -2.5 and the HUD reads LOWER SNAP ZONE, downward stretch is overextended. Wait for OrangeRed bars to contract and curl back above the Gold signal curve to time mean-reversion bounces or protect short profits.
Trend Stretch and Equilibrium Filter:
During steady directional trends, price often rides cleanly inside the Teal (0.0 to +2.5) or FireBrick (0.0 to -2.5) normal stretch zones before accelerating into extreme snap territory. Readings clustering tightly around 0.0 indicate balanced equilibrium with minimal elastic tension.
TECHNICAL SPECIFICATIONS AND INPUT PARAMETERS
Calculation Engine:
100 percent causal bar-by-bar indexing with zero repainting, zero backpainting, and zero external DLL calls. Subwindow short name: OU_Tension(55).
Input Parameters:
- InpPeriod (Default: 55): Rolling lookback window for both the equilibrium SMA and volatility ATR normalization.
- InpSignalPeriod (Default: 8): EMA smoothing period for the Gold OU_Signal_Curve line.
- InpExtremeLevel (Default: 2.50): Symmetric ATR multiple threshold separating normal directional stretch from extreme snap-back zones.
- InpShowHUD (Default: true): Toggles the 2-line upper-right telemetry HUD (automatically bypassed during Strategy Tester optimization).
Expert Advisor Integration (iCustom Buffer Map):
- Buffer 0: Bull_Normal_Stretch (Teal positive bars below threshold)
- Buffer 1: Bull_Extreme_Snap (Aqua bold positive bars at or above threshold)
- Buffer 2: Bear_Normal_Stretch (FireBrick negative bars above negative threshold)
- Buffer 3: Bear_Extreme_Snap (OrangeRed bold negative bars at or below negative threshold)
- Buffer 4: OU_Signal_Curve (Gold 8-period EMA curve)
- Buffer 5: OU_Tension_Net (Hidden continuous raw uncapped ATR tension value for automated logic)
TIMEFRAME AND VOLATILITY CALIBRATION (CUSTOMIZE TO YOUR CHART)
The default settings (55 equilibrium period, 8 signal period, 2.50 ATR extreme zone) provide a balanced M15 to H1 baseline across Major Forex pairs, Gold, and Indices, and every parameter can be adjusted to fit your strategy:
- Active Intraday Mean Reversion (M5 to M15): Lower InpPeriod to 34 and InpSignalPeriod to 5 for quicker stretch cycles, or narrow InpExtremeLevel to 2.00 on calmer range-bound currency pairs.
- Strong Trending Assets (Gold, US Indices, JPY Crosses): Raise InpExtremeLevel to 3.00 to 3.50 so normal trend impulses stay inside the Teal/FireBrick zone and Aqua/OrangeRed highlights only genuine parabolic overextensions.
- Macro Swing Equilibrium (H4 to D1): Increase InpPeriod to 89 and InpSignalPeriod to 13 to track multi-day structural extensions away from higher-timeframe fair value.
------ALSO AVAILABLE FOR METATRADER 5 (MT5)
Trading on MetaTrader 5 instead of MetaTrader 4? The identically engineered MetaTrader 5 edition of OU Elastic Tension Meter is available on my MQL5 Seller Profile with the exact same thumbnail, ATR tension engine, telemetry HUD, and parameter set.
