Yang-Zhang volatility estimator

Category: Indicators By: hq76 Created: February 12, 2016, 1:56 PM
February 12, 2016, 1:56 PM
Indicators
2 Comments

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 New
I usually let my code do the talking, which explains why my bio is as empty as a newly created file. Bio to be initialized...
Author’s Profile

Comments

Logo Logo
Loading...