The Volatility.Series calculation
Author: lksf
Creation Date: 2/11/2009 8:17 PM
profile picture


I have a feeling the Volatility.Series isn't being calculated correctly.

I've looked at the help section ( and the formula there is different than what it is on several other tools.

The correct formula, as I know it, should be:

CV = ((HLAVE(c) - HLAVE(c-n)) / HLAVE(c-n))*100

where (c) means current
and (c-n) means n bars ago
and, naturally, I hope you don't use 10days EMA but the actual parameter.

In addition, results tested do not match other tools' results (yet these tools all produce the same results among themselves).

Not to be too nosy (as I don't really like rewriting tools, I'd rather use them) I tried checking the code using .Net reflector but for some reason, out of all methods and indicators that are open, this one's CalcNextVal is obfuscated.

Please have this checked and post your analysis result.

profile picture


Since we have no clue about this "other software" and what method did they use, let's open up something that could be a good reference. When I don't have access to the original author's book/article, I consider Robert Colby's bible (The Encyclopedia of Technical Market Indicators) to be sufficient. Take the simple MetaStock formula there:

To verify that Wealth-Lab uses the correct calculation that matches the original formula, run this simple code where you should see just 1 line:
Please log in to see this code.

profile picture


Yet another code for you to make sure that WL's implementation is the correct one. Now coded up to the Incredible Charts formula - which is your formula:

Please log in to see this code.
profile picture


Thanks for the reply and the detailed samples.
I think the problem relies on the fact that the first items in the EMA series are all 0.
I need to read some more about EMA calculation to understand the method of producing the "lead" items in the series, I'm not sure that 0 is the correct value.
While it does makes sense to return the value 0 when asking for an EMA's value before the period passed (e.g asking for EMA.Series(Close,10,EMACalculation.Modern)[5] should return 0) I think that an actual value calculated as ususal i.e. the first value of the EMA Series equals to the first value of the series being averaged and all subsequent values are calculated using the standard formula of EMA = ( K x ( C - EMA1 ) ) + EMA1

I am not 100% sure about both the correctness of my suggestion and I need to check the official EMA definition but I think ultimately this change will produce the identical results I'm seeing elsewhere.

Your opinion?
profile picture


Wealth-Lab's calculation starts by taking the simple average of the seed bars, so that's why the indicator returns zero for those bars.

Either way, EMA is one of the Unstable Indicators, and you shouldn't be "using" its value prior to about 3 times its period. If you do, the values will fluctuate a lot even for the same day depending on the start day no matter which calculation you use.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).