OPEN-SOURCE SCRIPT

Cointégration

40
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.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.