joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
326 stars 102 forks source link

Discrepancy in Source code and Documentation for volatility(calc="yang.zhang") #72

Closed AniketBhanu closed 5 years ago

AniketBhanu commented 5 years ago

As per the reference manual on volatility(calc="yang.zhang"), the calculation of k should be: k <- (alpha)/(1 + (n + 1)/(n - 1))

whereas, the calculation in the source code is: k <- (alpha - 1)/(alpha + (n + 1)/(n - 1))

I believe that the calculation in the source code is correct and the documentation needs to be updated.

joshuaulrich commented 5 years ago

Thanks for the report! Looks like this was introduced in the code all the way back in commit eb0fd34332fca1cdef34849404dd4d249785bc76. The documentation wasn't updated until commit 697012f51eb1e5941f693e9334dfefbb2ae00c88, where you can see the equations for text and LaTeX for "yang.zhang" are different.