indicator · own pane · open source

Yang-Zhang Volatility

Deepwick · @deepwickv1Updated 2 Oct 2026▲ 0 users
Running…
Loading chart…

About

Yang-Zhang Volatility combines overnight close-to-open variance, open-to-close drift and intraday high-low range into a single annualised estimator.

  • Handles gaps cleanly — open moves don't get washed out like in HV.
  • Slightly noisier than GK but the most realistic single number for crypto & 24/7 markets.

Source code

//@version=5
indicator("Yang-Zhang Volatility", overlay=false)
len = input.int(20, "Lookback", minval=2, maxval=252)
yzX = math.pow(math.log(close / close[1]), 2) + 0.5 * math.pow(math.log(high / low), 2)
yzSum = ta.cum(yzX) - ta.cum(yzX)[len]
yz = math.sqrt(252 / len * yzSum)
p_YZ = plot(yz, "YZ", color=color.purple, linewidth=2)

Comments

No comments yet.

Sign in to comment.