OPEN-SOURCE SCRIPT

Cointégration

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

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.