indicator · own pane · open source
Garman-Klass Volatility
Running…
Loading chart…
About
Garman-Klass Volatility adds an open-to-close variance term to the Parkinson high-low estimator.
- More efficient than Parkinson because it uses the open in addition to the range.
- Best for liquid instruments where the open prints near the prior close.
Source code
//@version=5
indicator("Garman-Klass Volatility", overlay=false)
len = input.int(20, "Lookback", minval=2, maxval=252)
gkX = 0.5 * math.pow(math.log(high / low), 2) - (2 * math.log(2) - 1) * math.pow(math.log(open / close), 2)
gkSum = ta.cum(gkX) - ta.cum(gkX)[len]
gk = math.sqrt(252 / len * gkSum)
p_GK = plot(gk, "GK", color=color.purple, linewidth=2)
No comments yet.
Sign in to comment.