Ornstein Uhlenbeck Z score1 ORNSTEIN–UHLENBECK Z-SCORE (SPREAD)
This is the main indicator of the series and is typically placed in a separate lower panel.
WHAT IT DOES
The indicator builds a spread between two assets and evaluates how far the current spread is from its long-term equilibrium.
The result is expressed as a Z-score based on an Ornstein–Uhlenbeck type mean-reverting process.
HOW IT WORKS
• The user selects a second asset in the settings
• A spread between the two assets is calculated (price difference or log price spread)
• The spread is modeled as a mean-reverting process over a rolling window
• A Z-score is calculated to measure deviation from equilibrium
Trading signals are generated when the Z-score reaches extreme values and exits when it returns to equilibrium.
HOW TO USE
This indicator does NOT generate signals to buy or sell a single asset.
It generates signals for a paired, hedged position.
• Long signal means long the first asset and short the second
• Short signal means short the first asset and long the second
The trader is always trading the spread, not the market direction.
RECOMMENDED TO USE WITH
• OU Signals Overlay for visualizing trades on the main chart
• Correlation Stability indicator to filter weak or unstable pairs
אינדיקטור Pine Script®






















