[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Volatility & Predicting Future Range


  • To: omega-list@xxxxxxxxxx
  • Subject: Re: Volatility & Predicting Future Range
  • From: gary@xxxxxxxxxxxx (Gary Funck)
  • Date: Mon, 16 Feb 1998 17:36:21 -0800 (PST)
  • In-reply-to: <cvinton@xxxxxxxxxxxxxx>

PureBytes Links

Trading Reference Links

Nice work - a few questions/suggestions:

> Here's two indicators, separated by {***************}
> 
> {"Volatility" plots Current, Highest, Lowest and Mean (midpoint between 
> highest - lowest of the Lookback period) Volatility.  Note:  On the first 
> bar of the Lookback period, Highest, Lowest and Mean should all equal 
> Current.  Sometimes, Lowest equals zero.  In this event just increase the 
> lookback by 1, until it is correct.}
> 
> { Volatility }
> Inputs: VolPer(20),EndDate(0),Lookback(365);
> 
> Vars: HVol(0),NLog(0),PC(0),EDate(0),
> MyVol(0),HMyVol(0),LMyVol(0),MMyVol(0),ABar(0);
> 
> 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?

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;

> 
>     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?

What's the motivation for introducing Endate?  Why would you want to
end the calculation before LastCalcDate?

> 
>     If Date >= JulianToDate(Value2) and Date <= Edate then begin
>       If CurrentBar = ABar then begin
>          HMyVol = MyVol;
>       End Else Begin
>          If MyVol >= HMyVol[1] then
>             HMyVol = MyVol
>          Else
>             HMyVol = HMyVol[1];
>       End;

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?

>     If Date >= JulianToDate(Value2) and Date <= Edate then begin
> 
>       If CurrentBar = ABar then begin
>          LMyVol = MyVol;
>       End Else Begin
>          If MyVol <= LMyVol[1] then
>             LMyVol = MyVol
>          Else
>             LMyVol = LMyVol[1];
>       End;
> 
>       MMyVol = LMyVol + ((HMyVol - LMyVol) / 2);
> 
>       Plot2(HMyVol,"HVol");
>       Plot3(LMyVol,"LVol");
>       Plot4(MMyVol,"MVol");
>     End;
> End;

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;

> 
> {*************************************}
> 
> {Probable Range allows input of a StrtDate, number of days in the future for 
> "Forecast", desired probability in increments of 5 - "Prob(85)" is 85% 
> probability (~1 standard deviation), "Mean(true)" the indicator will use the 
> greater of "Current Volatility" or "Mean Volatility" of period "Lookback".  
> An input greater than zero for "Vola" (Volatility) will override 
> "Mean(true)".  "VolPer(20)" is the Volatility Period.  20 trading days 
> approximates 30 calendar day volatility.}
> 
> 
> { 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?

> 
> 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);
>               
> 
> 
> 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;

I like the method above for specifying the number of sigmas
(standard deviations), based on the desired probability.

> 
> 
> If Date = StrtDate then begin
>     PRHC = Price * ExpValue((Vol / 100) * SquareRoot(Forecast / 365) *  factor);
> end;
> 
> If Date = StrtDate then begin
>       PRLC = Price * ExpValue((Vol / 100) * SquareRoot(Forecast / 365) * - factor);
> end;

Above 365, should be 252?

I think the calculation above should move Factor outside of the
ExpValue calcuation:

  If Date = StrtDate Then Begin
     sigma = 1.0 - ExpValue(Vol * 0.01 * SquareRoot(Forecast/252));
     PRHC = Price * (1 + sigma * Factor);
     PRLC = Price / (1 + sigma * Factor);
  End;

> 
> Value1 = DateToJulian(StrtDate);
> Value2 = Value1 + Forecast;
> 
> If ShowPRH = true then begin
>     If PRHC > 0 and Date <= JulianToDate(Value2) then
>     Plot1(PRHC,"PRH");
> end;  
> If ShowPRL = true then begin
>     If PRLC > 0 and Date <= JulianToDate(Value2) then
>     Plot2(PRLC,"PRL");
> End;

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");



-- 
--
| Gary Funck,  Intrepid Technology, gary@xxxxxxxxxxxx, (650) 964-8135