PureBytes Links
Trading Reference Links
|
At 09:07 PM 12/16/97 -0500, Glenn Orlosky wrote:
>I received a flyer on MetaStock 6.5 and see they have an ODDS
>Probability Cone study from Don Fishback, which draws nice a parabolic
>cone based on something. Does anyone have a clue as to where that info
>can be found and if there is an existing *.ela which would draw such?
>
>Glenn
>
>
Following is my Probable Range indicator that will give you a start.
It's used for calculating the strike prices for a Short Strangle. I like to
use the Mean Volatility (midpoint between the highest and lowest) of the
past year as the input for volatility.
Be aware (Beware) the portion of the code that calculates the mean
volatility has a "bug" that I've not been able to fix. On the first day of
the "lookback" period, lowest volatility "should" equal "current"
volatility. Sometimes, it equals zero. Therefore, it remains zero and the
"mean" volatility is not correct. So, I've also included the Volatility
indicator, so that you can input the desired volatility, after changing the
input for "lookback" to be certain lowest volatility does not equal zero.
I imagine a cone would be plotted by calculating Probable Range for each day
from the start date, rather than just calculating Probable Range for a
future date such as 30 days in the future. In other words, plot Probable
Range for 1 day, then 2 days, then 3 days, etc.
Ron
archer@xxxxxxx
{*************** Probable Range ******************}
Inputs: StrtDate(971017),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);
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;
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;
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;
{***************** 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;
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;
If Date >= JulianToDate(Value2) and Date <= Edate then begin
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);
Plot2(HMyVol,"HVol");
Plot3(LMyVol,"LVol");
Plot4(MMyVol,"MVol");
End;
End;
|