HISTORICAL VOLATILITY

HISTORICAL VOLATILITY

Type : Indicator, Name : Historical Volatility

{ Name: Historical Volatility Created: 10/6/97 02:05 PM }

vars:
SumSqr(0),
Mean(0),
Sum(0),
counter(0),
Hist_Vol(0);

inputs:
Length(18);

array:
Stdarray[100](0);

if Length > 0 and close > 0 then begin

Sum = 0;
for counter = 0 to (Length-1) begin
Stdarray[counter] = Log(close[counter] / close[counter+1]);
Sum = Stdarray[counter] + Sum;
end;

Mean = Sum / Length;

SumSqr = 0;
for counter = 0 to (Length-1) begin
SumSqr = SumSqr + ((Stdarray[counter] — Mean) * (Stdarray[counter] —
Mean));
end;

Hist_Vol = SquareRoot(SumSqr / Length)*SquareRoot(250);

end
else
Hist_Vol = 0;

plot1(Hist_Vol, «Hist_Vol»);

Подписаться
Уведомить о
0 комментариев
Межтекстовые Отзывы
Посмотреть все комментарии