hq76

Yang-Zhang volatility estimator

Category: Indicators By: hq76 Created: February 12, 2016, 1:56 PM
February 12, 2016, 1:56 PM
Indicators
2 Comments
Yang-Zhang volatility estimator

For those interested in options pricing and volatility indicator, here is one that draw recent volatility based on High, Low, Open and Close prices.

For more explanation see this paper : http://atmif.com/papers/range.pdf

//parameters
// n = 20
// averageP = 200

No = log( open ) - log( close[1] )  // normalized open
Nu = log( high ) - log( open )             // normalized high
Nd = log( low ) - log( open )              // normalized low
Nc = log( close ) - log( open )            // normalized close

Vrs = 1 / n * Summation[n]( Nu * ( Nu - Nc ) + Nd * ( Nd - Nc ))  // RS volatility estimator

Noavg = 1 / n * Summation[n](No)
Vo = 1 / ( n - 1 ) * Summation[n]( SQUARE( No - Noavg ) )

Ncavg = 1 / n * Summation[n]( Nc )
Vc = 1 / ( n - 1 ) * Summation[n]( SQUARE( Nc - Ncavg ) )

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

Vyangzhang = Vo + k * Vc + ( 1 - k ) * Vrs

avg = average[averageP](Vyangzhang)

return Vyangzhang, avg as "average volatiliy"

 

code adapted from AmiBroker

Download
Filename: Yan-Zhang-Volatility-estimator.itf
Downloads: 103
hq76
hq76 New
This author is like an anonymous function, present but not directly identifiable. More details on this code architect as soon as they exit 'incognito' mode.
Author’s Profile

Comments

RickTrader
4 years ago
#

I think to have annualized view of this historical volatility you will need : Vyangzhang = SQRT(Vo + k * Vc + ( 1 - k ) * Vrs) *SQRT(252)

r.angel
7 years ago
#

It seems that the formula needs a SQRT (that is Vyangzhang = SQRT(...))

ProRealCode ProRealCode
Loading...