PureBytes Links
Trading Reference Links
|
Thanks to archer (who is that masked man?), I have taken his Probability
Range Indicator and made a Probable Range Cone Indicator (touted in
MetaStock 6.5 as a "NEW" study). Try it on the S&P 500 daily (should
work on anything with price and volume - may need to change
DataCompression setting if you want to fiddle). I also included the
DFrmLstB() function which I use alot and i substituted for his 971017
(Option expiration date). I made one other change and I don't understand
why, but I had to use the squareroot of two as the counter to make the
cone touch the ends of his plotted lines (which I plotted his indicator
at Forecast of 5,10,15,20,25,30 and mine at Forecast 30 - try it, you'll
see what I mean).
As always, FREE to you guys.
Glenn
{***************DFrmLstB() FUNCTION *****************
INPUT : BarsBack(NUMERICSIMPLE);
VAR : x(0);
IF CurrentBar > 1 THEN BEGIN
Value1 = DateToJulian(LastCalcDate);
FOR x = 0 TO BarsBack BEGIN
Value2 = JulianToDate(Value1);
Value3 = DayOfWeek(Value2);
IF Value3 = 0 OR Value3 = 6 THEN x = x - 1;
Value1 = Value1 - 1;
END;
DFrmLstB = Value2;
END;
Instead of entering an offset date for the StrtDate input simply type in
the function name with the offset; like so...
INPUTS : StrtDate(DFrmLstB(14)),etc.,,,;}
{*************** Probable Range Cone INDICATOR ******************}
Inputs: StrtDate(DFrmLstB(42)),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)
|