Is this codeable in mql4?
The Yang Zhang extension of the Garman-Klass volatility is considered to be the second most precise method to evaluate ex-ante volatility......
Code: Select all
//YANG-ZHANG extention of the GARMAN-KLASS volatility
p=22
corr=sqrt(p/(p-1))
gkyzoc=log(open/close[1])*log(open/close[1])
gkyzhl=0.5*log(high/low)*log(high/low)
gkyzco=(2*log(2)-1)*log(close/open)*log(close/open)
gkyz=sqrt(summation[p](gkyzoc+gkyzhl-gkyzco))*sqrt(256/p)
gkyzvolatility=gkyz*corr
return gkyzvolatility as "Garman-Klass Yang-Zhang"
//YANG-ZHANG extention of the GARMAN-KLASS volatility
p=22
corr=sqrt(p/(p-1))
gkyzoc=log(open/close[1])*log(open/close[1])
gkyzhl=0.5*log(high/low)*log(high/low)
gkyzco=(2*log(2)-1)*log(close/open)*log(close/open)
gkyz=sqrt(summation[p](gkyzoc+gkyzhl-gkyzco))*sqrt(256/p)
gkyzvolatility=gkyz*corr
return gkyzvolatility as "Garman-Klass Yang-Zhang"