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
Code artist, my biography is a blank page waiting to be scripted. Imagine a bio so awesome it hasn't been coded yet.
Author’s Profile

Comments

Logo Logo
Loading...