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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
//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
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
It seems that the formula needs a SQRT (that is Vyangzhang = SQRT(…))
I think to have annualized view of this historical volatility you will need :
Vyangzhang = SQRT(Vo + k * Vc + ( 1 – k ) * Vrs) *SQRT(252)