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.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.