WHAT IS THIS?
This is my personal port of the Logarithmic Garman-Klass as openly found at iVolatility.com.
This estimator tends to be as fast as the RiskMetrics EWMA but without the noisy overshooting and will not lag as other estimators based on pure arithmetic Standard Deviation like Close-To-Close HV, Original Garman-Klass, Parkinson’s, Rogers-Satchell’s, Yang-Zhang, etc.
Cheers, and any contributions will be welcome.
THE CODE:
// LOGARITHM GARMAN-KLASS VOLATILITY ESTIMATOR by @Xel_arjona
// Ported to ProReaCode as Formulae openly described in http://www.ivolatility.com/help/7.html
lnCC = log(close/close[1])
lnCO = log(close/open)
lnOC = log(open/close[1])
lnHL = log(high/low)
// Lambda definition:
lambda = Lookback/(Lookback+3)
//Initialization with Close-To-Close Historical Volatility
varCC = summation[Lookback](square(lnCC)) / Lookback
//Logarithmic Garman-Klass Realized/Historical Estimate as in iVolatility.com
v2 = square(lnoc) + 0.5*square(lnHL) - 0.386*square(lnCO)
varLGK = varCC
varLGK = exp( (1-lambda)*log(v2[1])+lambda*log(varLGK) )
LGKest = sqrt(varLGK)*sqrt(Compound) * 100
// PLOT DIRECTIVE
RETURN LGKest as "LGK"
DISCLAIMER: The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.
The embedded code and ideas within this work are FREELY AND PUBLICLY available on the Web for NON LUCRATIVE ACTIVITIES and must remain as is by Creative-Commons and in regard of ProRealCode regulations. Any use, copy or re-use of this code should mention it’s origin as it’s authorship.
XeL 2017