PureBytes Links
Trading Reference Links
|
At 05:23 PM 2/16/98 -0800, Gary Funck wrote:
>Nice work - a few questions/suggestions:
>
<snip>
>>
>> If DataCompression <= 2 then begin
>> If Close[1]<>0 Then PC = (Close / Close[1]) Else PC = 1;
>> NLog = Log(PC);
>> HVol = StdDev(NLog,(VolPer)) * SquareRoot(365);
>> MyVol= HVol * 100;
>
>Since you're using trading days, shouldn't 365 be 252 instead?
Consider the behavior of the price of an option from Friday afternoon to
Monday morning. All other things being equal, the option's price declines
more from Friday afternoon to Monday morning than it does from Thursday
afternoon to Friday morning. If you use 252, the option's time decay would
be the same Friday to Monday, as Thursday to Friday.
>
>Shouldn't the volatility period (VolPer) be in this calculation
>in order to annualize the Historic Volatility? For example,
> HVol = StdDev(NLog, VolPer) * SquareRoot(VolPer/252);
> MyVol= HVol * 100;
>
>>
I don't think so...
Reference: Option Volatility & Pricing, Sheldon Natenberg, page 443-444
Weekly data requires: SquareRoot(365/7);
>> Plot1(MyVol,"Vola");
>>
>> If EndDate <> 0 then EDate = EndDate
>> else EDate = LastCalcDate;
>>
>> Value1 = DateToJulian(EDate);
>> Value2 = Value1 - Lookback;
>> If Date = JulianToDate(Value2) then ABar = CurrentBar;
>
>So, Lookback is used as an interval to keep track of the highest
>and lowest volatility recorded in the the lookback period? Since
>you're using trading days, wouldn't 252 be closer to one calendar year?
Yes.
In order to calculate "Probable Range", the most important "Volatility" to
calculate is "Future Volatility". No, I haven't found a method to calculate
"Future Volatility", so I use the greater of Current or Mean Volatility of
the past year (or so)<g>.
>
>What's the motivation for introducing Endate? Why would you want to
>end the calculation before LastCalcDate?
It is useful for testing strategies on historical data. For example, I
might plot the paintbar for "NextThirdFriday" (Options expiration) and go
back over the historical data, inputing those dates as "EndDate", then input
the next previous Options Expiration as StrtDate for "Probable Range". With
"EndDate", I was able to see the volatility of the previous year.
<snip>
>
>Above, it looks to me as if HMyVol will keep climbing until Edate
>is hit, but won't have the effect of always reflecting the highest
>volatility in the lookback period?
Hmmm... works for me<G>
<snip>
>
>Why not avoid the Edate and Edate - 252 calculation altogether and
>simply try the following:
>
> if CurrentBar >= (Lookback + Volper) then begin
> HNyvol = Highest(Myvol, Lookback);
> LNyvol = Lowest(Myvol, Lookback);
> MMyVol = LMyVol + ((HMyVol - LMyVol) / 2);
> Plot2(HMyVol,"HVol");
> Plot3(LMyVol,"LVol");
> Plot4(MMyVol,"MVol");
> end;
>
Yes, that works, except for backtesting.
<snip>
>>
>> { Probable Range }
>> Inputs: StrtDate(971017),Forecast(30),Prob(85),Mean(true),Vola(0),
>>
VolPer(20),Lookback(365),Price(Close),ShowPRH(True),ShowPRL(True);
>
>What's the reason for having a Strtdate variable? To limit the amount
>of time for calculations on a long time series?
I like to select the Price to begin the forecast. Perhaps, it will be the
Close on the day of Option's Expiration with a forecast to the next
expiration; in order to determine the strikes for a short strangle.
Perhaps, the Close on Option's Expiration is a SwingHigh or SwingLow, so I
move back for StartDate to the Close that is the midpoint of the most recent
swing.
<snip>
>I think the plot will be more useful, if we compare the current price to
>the forecast that was calculated "Forecast" bars ago, rather than
>plotting the current forecast in the curent bar:
>
> If ShowPRH = true and PRHC > 0 and Date <= JulianToDate(Value2) then
> Plot1(PRHC[Forecast],"PRH");
> If ShowPRL = true and PRLC > 0 and Date <= JulianToDate(Value2) then
> Plot2(PRLC[Forecast],"PRL");
My only use for the plots is to know the value for the forecast date;
between StartDate and the Forecast Date, they have no purpose. Price may
advance/decline above/below the values and still Close within the range on
the forecast date.
Someone else recently modified the Probable Range indicator to forecast one
day at a time. Perhaps this would interest you.
{*************** Probable Range Cone INDICATOR ******************}
Inputs: StrtDate(971112),Forecast(30),Prob(85),Mean(true),Vola(0),
VolPer(20),Lookback(365),Price(Close),ShowPRH(True),ShowPRL(True);
Vars: PC(0),NLog(0),HVol(0),MyVol(0),HMyVol(0),LMyVol(0),
MMyVol(0),ABar(0),Vol(0),PRHC(0),PRLC(0),Factor(0),FCH(0),FCL(0),PSD(0),VSD
(0);
If DataCompression = 2 then begin
If Price[1]<>0 Then PC = (Price / Price[1]) Else PC = 1;
NLog = Log(PC);
HVol = StdDev(NLog,(VolPer)) * SquareRoot(365);
MyVol= HVol * 100;
Value1 = DateToJulian(StrtDate);
Value2 = Value1 - Lookback;
If Date = JulianToDate(Value2) then ABar = CurrentBar;
If CurrentBar = ABar then begin
HMyVol = MyVol;
End Else
If MyVol > HMyVol[1] then
HMyVol = MyVol
Else
HMyVol = HMyVol[1];
If CurrentBar = ABar then begin
LMyVol = MyVol;
End Else
If MyVol < LMyVol[1] then
LMyVol = MyVol
Else
LMyVol = LMyVol[1];
MMyVol = LMyVol + ((HMyVol - LMyVol) / 2);
End;
If Mean = True and Vola = 0 then begin
If MMyVol > MyVol then Vol = MMyVol
else Vol = MyVol;
end else
If Mean = False and Vola = 0 then begin
Vol = MyVol;
end else
If Vola > 0 then begin
Vol = Vola;
end;
If Prob = 50 then factor = 0
else If Prob = 55 then factor = .125661
else If Prob = 60 then factor = .253347
else If Prob = 65 then factor = .385321
else If Prob = 70 then factor = .524401
else If Prob = 75 then factor = .67449
else If Prob = 80 then factor = .841621
else If Prob = 85 then factor = 1.036433
else If Prob = 90 then factor = 1.281551
else If Prob = 95 then factor = 1.644853;
{Lock in the data on the StrtDate}
If Date = StrtDate then begin
PSD=price;
VSD=Vol;
end;
If Date >= StrtDate then begin
PRHC = PSD * ExpValue((VSD / 100) * SquareRoot(FCH / 365) * factor);
FCH=FCH+1.414;
end;
If Date >= StrtDate then begin
PRLC = PSD * ExpValue((VSD / 100) * SquareRoot(FCL / 365) * - factor);
FCL=FCL+1.414;
end;
Value1 = DateToJulian(StrtDate);
Value2 = Value1 + ForeCast;
If ShowPRH = true then begin
If PRHC > 0 and Date >= StrtDate and Date <= JulianToDate(Value2) then
Plot1(PRHC,"PRH");
end;
If ShowPRL = true then begin
If PRLC > 0 and Date >= StrtDate and Date <= JulianToDate(Value2) then
Plot2(PRLC,"PRL");
end;
print(Date:8:0,PRLC:8:0,PRHC:8:0)
|