PureBytes Links
Trading Reference Links
|
Check the Omega's standard deviation function and you will find that it
is wrong.
Here's a correct one.
{========================================
User Function Below was furnished by Jim Osborne of
The Omega List and is a fix for Omegas own StdDev func.
Name it : stddevx
========================================}
inputs : Price(NumericSeries),Length(NumericSimple);
vars : SumSqr(0),Avg(0),Counter(0);
if Length <> 0
then begin
Avg = Average(Price,Length);
SumSqr = 0;
for counter = 0 to Length - 1
begin
SumSqr = SumSqr + (Price[counter]-Avg) * (Price[counter]-Avg);
end;
StdDevX = SquareRoot(SumSqr / (Length-1)); {<-- Omega's doesn't
subtract 1 here}
end
else
StdDevX = 0;
Also, the volatility coded (<--oop's typo, typo. please don't flame me
Ed) posted by Mark Brown is actually my code. If you check his post you
will see reference to JRehler(Thank you Mark fro (<-- aahh, another
typo) the acknowledgement). So, he really can't answer your questions as
to why it was coded this way as opposed to that.
Anyway, I'll have to think about some of your questions as to why I did
this or that, but I basically looked at the equation in Natenburg's book
and coded it in EL. This was three or four years ago, so I have
forgotten why I did things the way I did. I can't seem to recall why I
didn't use the log function as you did, but there was a reason and I
didn't multiple by 100 because I was use (<--typo,typo please forgive me
Ed) the raw number and not a percent in another calculation.
|