PureBytes Links
Trading Reference Links
|
On Feb 16, 8:35pm, Orphelin@xxxxxxx wrote:
> Subject: Re : Volatility (alternate)
bonjour Pierre,
> {User Function SrVola.
> Code by Pierre Orphelin
> www.sirtrade.com}
>
> input:recvola(numeric); {lookback period}
> vars:dlr(0),valueX(252);
>
> if datacompression=3 then valueX=52;
> if datacompression=4 then valueX=12;
>
> if recvola>1 then begin
> dlr=square(log((c/c[1])-average(log(c/c[1]),recvola)));
> Srvola=100*(squareroot(valueX)*squareroot(Summation(dlr,recvola)/(recvola-1))
> );
> end;
You avoided the one day lag in Mark's approach by computing
c/c[1], where Mark's logic used the equivalent of c[1]/c[2].
Why the test for recvola>1? Just an input error check?
Why did you use Close (C) above, instead of an input numeric series?
Why do you and Mark recode StdDev(), rather than use it directly?
This looks a lot simpler to me:
Value1 = log(c/c[1]);
Srvola = 100 * stddev(Value1, recvola);
--
--
| Gary Funck, Intrepid Technology, gary@xxxxxxxxxxxx, (650) 964-8135
|