Firedrops

Volatility Estimator - YZ & RS

The Yang-Zheng Volatility Estimator (YZVE) integrates both intra-candle and inter-candle dynamics, such as overnight and weekend price changes, offering a more detailed analysis compared to traditional methods. The YZVE is proposed to improve over the standard deviation by accounting for the open, high, low, and close prices of trading periods, instead of only the close prices, and attempts to supplant the Parkinson's Volatility Estimator (PVE) by a also capturing inter-candle dynamics. The YZVE is calculated by this formula:

YZ Volatility Squared σ_YZ² = k * σ_o² + σ_rs² + (1 - k) * σ_c²

where k is a weighting factor that adjusts the emphasis between the overnight and close-to-close components, popularly estimated as:

k = 0.34 / (1.34 + (N+1) / (N-1))

where N is the lookback period. Optionally, users may opt to override this calculation with a specified constant (off by default). Next, the

Overnight Volatility Squared σ_o² = (log(O_t / C_(t-1)))²

measures the volatility associated with overnight price changes, from the previous candle's closing price C_(t-1) to the current candle's opening price O_t. It captures the market's reaction to news and events that occur outside of regular trading hours to reflect risk associated with holding positions over non-trading hours and gaps.

Next, the The Rogers-Satchell Volatility Estimator (RSVE) serves as an intermediary step in the computation of YZVE. It aggregates the logarithmic ratios between high, low, open, and close prices within each trading period, focusing on intra-candle volatility without assuming zero inter-candle drift as commonly implicitly assumed in other volatility models:

Rogers-Satchell Volatility Squared σ_rs² = (log(H_t / C_t) * log(H_t / O_t)) + (log(L_t / C_t) * log(L_t / O_t))

Finally,

Close-to-Close Volatility Squared σ_c² = (log(C_t / C_(t-1)))²

measures the volatility from the close of one candle to the close of the next. It reflects the typical candle volatility, similar to naive standard deviation.

This script also includes an option for users to apply the simpler RS Volatility exclusively, focusing on intraday price movements. Additionally, it offers a choice for normalization between 0 and 1, turning the estimator into an oscillator for comparing current volatility to recent levels. Horizontal lines at user-defined levels are also available for clearer visualization. Both are off by default.

References:

Yang, D., & Zhang, Q. (2000). Drift-independent volatility estimation based on high, low, open, and close prices. The Journal of Business, 73(3), 477-491.

Rogers, L.C.G., & Satchell, S.E. (1991). Estimating variance from high, low and closing prices. Annals of Applied Probability, 1(4), 504-512.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

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

차트에 이 스크립트를 사용하시겠습니까?