OPEN-SOURCE SCRIPT

Cointégration

39
This Pine Script v6 indicator approximates cointegration between ES and NQ futures by calculating a dynamic beta (hedge ratio) using manual covariance and variance on closing prices over a user-defined lookback period. It computes a mean-reverting spread as ES - (beta * NQ), then normalizes it into a Z-score for divergence detection. The script plots the Z-score with customizable thresholds and triggers alerts for potential trades, like long ES/short NQ when Z-score drops below -2. Add it to an ES1! or NQ1! chart for visualization, but backtest thoroughly as it's not a full statistical test.

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.