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

Ehler's Instantaneous Trendline & Sinewave Indicator - S&C issue May 2000



PureBytes Links

Trading Reference Links

thanks

mohan

Name: H cycle count 1a
value:= Fml("Hilbert cycle period - 1a");
If(Sum(value,6)>=360 AND Sum(value,5)<360 ,6,0) +
If(Sum(value,7)>=360 AND Sum(value,6)<360 ,7,0) +
If(Sum(value,8)>=360 AND Sum(value,7)<360 ,8,0) +
If(Sum(value,9)>=360 AND Sum(value,8)<360 ,9,0) +
If(Sum(value,10)>=360 AND Sum(value,9)<360 ,10,0) +
If(Sum(value,11)>=360 AND Sum(value,10)<360 ,11,0) +
If(Sum(value,12)>=360 AND Sum(value,11)<360 ,12,0) +
If(Sum(value,13)>=360 AND Sum(value,12)<360 ,13,0) +
If(Sum(value,14)>=360 AND Sum(value,13)<360 ,14,0) +
If(Sum(value,15)>=360 AND Sum(value,14)<360 ,15,0)

Name: H cycle count 2a
value:= Fml("Hilbert cycle period - 1a");
If(Sum(value,16)>=360 AND Sum(value,15)<360 ,16,0) +
If(Sum(value,17)>=360 AND Sum(value,16)<360 ,17,0) +
If(Sum(value,18)>=360 AND Sum(value,17)<360 ,18,0) +
If(Sum(value,19)>=360 AND Sum(value,18)<360 ,19,0) +
If(Sum(value,20)>=360 AND Sum(value,19)<360 ,20,0) +
If(Sum(value,21)>=360 AND Sum(value,20)<360 ,21,0) +
If(Sum(value,22)>=360 AND Sum(value,21)<360 ,22,0) +
If(Sum(value,23)>=360 AND Sum(value,22)<360 ,23,0) +
If(Sum(value,24)>=360 AND Sum(value,23)<360 ,24,0) +
If(Sum(value,25)>=360 AND Sum(value,24)<360 ,25,0)

Name: H cycle count 3a
value:= Fml("Hilbert cycle period - 1a");
If(Sum(value,26)>=360 AND Sum(value,25)<360 ,26,0) +
If(Sum(value,27)>=360 AND Sum(value,26)<360 ,27,0) +
If(Sum(value,28)>=360 AND Sum(value,27)<360 ,28,0) +
If(Sum(value,29)>=360 AND Sum(value,28)<360 ,29,0) +
If(Sum(value,30)>=360 AND Sum(value,29)<360 ,30,0) +
If(Sum(value,31)>=360 AND Sum(value,30)<360 ,31,0) +
If(Sum(value,32)>=360 AND Sum(value,31)<360 ,32,0) +
If(Sum(value,33)>=360 AND Sum(value,32)<360 ,33,0) +
If(Sum(value,34)>=360 AND Sum(value,33)<360 ,34,0) +
If(Sum(value,35)>=360 AND Sum(value,34)<360 ,35,0)

Name: H ip sum 1
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
(Cos(0)*pr)+
(Cos(360*(1/pd))*Ref(pr,-1))+
(Cos(360*(2/pd))*Ref(pr,-2))+
(Cos(360*(3/pd))*Ref(pr,-3))+
(Cos(360*(4/pd))*Ref(pr,-4))+
(Cos(360*(5/pd))*Ref(pr,-5))+
If(pd>6, Cos(360*(6/pd))*Ref(pr,-6), 0)+
If(pd>7, Cos(360*(7/pd))*Ref(pr,-7), 0)+
If(pd>8, Cos(360*(8/pd))*Ref(pr,-8), 0)+
If(pd>9, Cos(360*(9/pd))*Ref(pr,-9), 0)+
If(pd>10, Cos(360*(10/pd))*Ref(pr,-10), 0)+
If(pd>11, Cos(360*(11/pd))*Ref(pr,-11), 0)+
If(pd>12, Cos(360*(12/pd))*Ref(pr,-12), 0)+
If(pd>13, Cos(360*(13/pd))*Ref(pr,-13), 0)+
If(pd>14, Cos(360*(14/pd))*Ref(pr,-14), 0)

Name: H ip sum 2
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
If(pd>15, Cos(360*(15/pd))*Ref(pr,-15), 0)+
If(pd>16, Cos(360*(16/pd))*Ref(pr,-16), 0)+
If(pd>17, Cos(360*(17/pd))*Ref(pr,-17), 0)+
If(pd>18, Cos(360*(18/pd))*Ref(pr,-18), 0)+
If(pd>19, Cos(360*(19/pd))*Ref(pr,-19), 0)+
If(pd>20, Cos(360*(20/pd))*Ref(pr,-20), 0)+
If(pd>21, Cos(360*(21/pd))*Ref(pr,-21), 0)+
If(pd>22, Cos(360*(22/pd))*Ref(pr,-22), 0)+
If(pd>23, Cos(360*(23/pd))*Ref(pr,-23), 0)+
If(pd>24, Cos(360*(24/pd))*Ref(pr,-24), 0)

Name: H ip sum 3
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
If(pd>25, Cos(360*(25/pd))*Ref(pr,-25), 0)+
If(pd>26, Cos(360*(26/pd))*Ref(pr,-26), 0)+
If(pd>27, Cos(360*(27/pd))*Ref(pr,-27), 0)+
If(pd>28, Cos(360*(28/pd))*Ref(pr,-28), 0)+
If(pd>29, Cos(360*(29/pd))*Ref(pr,-29), 0)+
If(pd>30, Cos(360*(30/pd))*Ref(pr,-30), 0)+
If(pd>31, Cos(360*(31/pd))*Ref(pr,-31), 0)+
If(pd>32, Cos(360*(32/pd))*Ref(pr,-32), 0)+
If(pd>33, Cos(360*(33/pd))*Ref(pr,-33), 0)+
If(pd>34, Cos(360*(34/pd))*Ref(pr,-34), 0)

Name: H rp sum 1
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
(Sin(0)*pr)+
(Sin(360*(1/pd))*Ref(pr,-1))+
(Sin(360*(2/pd))*Ref(pr,-2))+
(Sin(360*(3/pd))*Ref(pr,-3))+
(Sin(360*(4/pd))*Ref(pr,-4))+
(Sin(360*(5/pd))*Ref(pr,-5))+
If(pd>6, Sin(360*(6/pd))*Ref(pr,-6), 0)+
If(pd>7, Sin(360*(7/pd))*Ref(pr,-7), 0)+
If(pd>8, Sin(360*(8/pd))*Ref(pr,-8), 0)+
If(pd>9, Sin(360*(9/pd))*Ref(pr,-9), 0)+
If(pd>10, Sin(360*(10/pd))*Ref(pr,-10), 0)+
If(pd>11, Sin(360*(11/pd))*Ref(pr,-11), 0)+
If(pd>12, Sin(360*(12/pd))*Ref(pr,-12), 0)+
If(pd>13, Sin(360*(13/pd))*Ref(pr,-13), 0)+
If(pd>14, Sin(360*(14/pd))*Ref(pr,-14), 0)

Name: H rp sum 2
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
If(pd>15, Sin(360*(15/pd))*Ref(pr,-15), 0)+
If(pd>16, Sin(360*(16/pd))*Ref(pr,-16), 0)+
If(pd>17, Sin(360*(17/pd))*Ref(pr,-17), 0)+
If(pd>18, Sin(360*(18/pd))*Ref(pr,-18), 0)+
If(pd>19, Sin(360*(19/pd))*Ref(pr,-19), 0)+
If(pd>20, Sin(360*(20/pd))*Ref(pr,-20), 0)+
If(pd>21, Sin(360*(21/pd))*Ref(pr,-21), 0)+
If(pd>22, Sin(360*(22/pd))*Ref(pr,-22), 0)+
If(pd>23, Sin(360*(23/pd))*Ref(pr,-23), 0)+
If(pd>24, Sin(360*(24/pd))*Ref(pr,-24), 0)

Name: H rp sum 3
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
If(pd>25, Sin(360*(25/pd))*Ref(pr,-25), 0)+
If(pd>26, Sin(360*(26/pd))*Ref(pr,-26), 0)+
If(pd>27, Sin(360*(27/pd))*Ref(pr,-27), 0)+
If(pd>28, Sin(360*(28/pd))*Ref(pr,-28), 0)+
If(pd>29, Sin(360*(29/pd))*Ref(pr,-29), 0)+
If(pd>30, Sin(360*(30/pd))*Ref(pr,-30), 0)+
If(pd>31, Sin(360*(31/pd))*Ref(pr,-31), 0)+
If(pd>32, Sin(360*(32/pd))*Ref(pr,-32), 0)+
If(pd>33, Sin(360*(33/pd))*Ref(pr,-33), 0)+
If(pd>34, Sin(360*(34/pd))*Ref(pr,-34), 0)

Name: H TL sum 1
value:=Int(Fml("Hilbert cycle period - final-a"));
If(value=6, Mov((H+L)/2,8,S),0) +
If(value=7, Mov((H+L)/2,9,S),0) +
If(value=8, Mov((H+L)/2,10,S),0) +
If(value=9, Mov((H+L)/2,11,S),0) +
If(value=10, Mov((H+L)/2,12,S),0) +
If(value=11, Mov((H+L)/2,13,S),0) +
If(value=12, Mov((H+L)/2,14,S),0) +
If(value=13, Mov((H+L)/2,15,S),0) +
If(value=14, Mov((H+L)/2,16,S),0) +
If(value=15, Mov((H+L)/2,17,S),0)

Name: H TL sum 2
value:=Int(Fml("Hilbert cycle period - final-a"));
If(value=16, Mov((H+L)/2,18,S),0) +
If(value=17, Mov((H+L)/2,19,S),0) +
If(value=18, Mov((H+L)/2,20,S),0) +
If(value=19, Mov((H+L)/2,21,S),0) +
If(value=20, Mov((H+L)/2,22,S),0) +
If(value=21, Mov((H+L)/2,23,S),0) +
If(value=22, Mov((H+L)/2,24,S),0) +
If(value=23, Mov((H+L)/2,25,S),0) +
If(value=24, Mov((H+L)/2,26,S),0) +
If(value=25, Mov((H+L)/2,27,S),0)

Name: H TL sum 3
value:=Int(Fml("Hilbert cycle period - final-a"));
If(value=26, Mov((H+L)/2,28,S),0) +
If(value=27, Mov((H+L)/2,29,S),0) +
If(value=28, Mov((H+L)/2,30,S),0) +
If(value=29, Mov((H+L)/2,31,S),0) +
If(value=30, Mov((H+L)/2,32,S),0) +
If(value=31, Mov((H+L)/2,33,S),0) +
If(value=32, Mov((H+L)/2,34,S),0) +
If(value=33, Mov((H+L)/2,35,S),0) +
If(value=34, Mov((H+L)/2,36,S),0) +
If(value=35, Mov((H+L)/2,37,S),0)

Name: Hilbert cycle period - 1a
value1:=((H+L)/2) - Ref(((H+L)/2),-6);
value2:= Ref(value1,-3);
value3:=0.75*(value1-Ref(value1,-6)) + 0.25*(Ref(value1,-2)-Ref(value1,-4));

inphase:= 0.33 * value2 + (0.67 * PREV);
quad:= 0.2 * value3 + ( 0.8 * PREV);

p1:=Atan(Abs(quad+Ref(quad,-1)),Abs(inphase+Ref(inphase,-1)));

phase:=If(inphase<0 AND quad>0, 180-p1, 
If(inphase<0 AND quad<0, 180+p1,
If(inphase>0 AND quad<0, 360-p1,p1)));

dp:=If(Ref(phase,-1)<90 AND phase>270, 360+Ref(phase,-1)-phase,Ref(phase,-1)-phase);
dp2:=If(dp < 1, 1,
If(dp > 60, 60, dp));

dp2

Name: Hilbert cycle period - final-a
c1:= Fml( "H cycle count 1a") + Fml( "H cycle count 2a") + Fml( "H cycle count 3a") ;
c2:=If(c1=0,PREV,c1);

(0.25*c2) + (0.75*PREV)

Name: Instantaneous Trend Line
pr:=(H+L)/2;

(Fml("H TL sum 1") + Fml("H TL sum 2") + Fml("H TL sum 3"));
0.33*(pr + (0.5*(pr-Ref(pr,-3)))) + (0.67*PREV)

Name: Sinewave Indicator
pd:=Int(Fml("Hilbert cycle period - final-a"));
cp:=Fml("Hilbert cycle period - final-a");
ip:=Fml( "H ip sum 1") + Fml( "H ip sum 2") +
Fml( "H ip sum 3");
rp:=Fml( "H rp sum 1") + Fml( "H rp sum 2") +
Fml( "H rp sum 3");

dc1:=If(Abs(ip)>0.001, Atan(rp/ip,1), 90*If(rp>=0,1,-1));
dc2:=If(pd<30 AND cp>0,dc1+((6.818/cp - 0.227)*360),dc1);
dc3:=If(ip<0, dc2+270, dc2+90);
dcp:=If(dc3>315, dc3-360, dc3);

Sin(dcp);
Sin(dcp+45)




/* John Ehler's Instantaneous Trendline & SineWave Indicator */

EnableScript("VBScript");

pr = (H+L)/2;

value1=((H+L)/2) - Ref(((H+L)/2),-6);

value2= Ref(value1,-3);

value3=0.75*(value1-Ref(value1,-6)) + 0.25*(Ref(value1,-2)-Ref(value1,-4));

<%

value1 = AFL("Value1")

value2 = AFL("Value2")

value3 = AFL("Value3")

Close = AFL("Close")

inphase = Close

quad = inphase

Call Setup()

Function Setup()

for i = 1 to Ubound(Close)

inphase(i) = 0.33 * value2(i) + (0.67 * inphase(i-1) ) 

quad(i) = 0.20 * value3(i) + ( 0.8 * quad(i-1) )

next

End Function

AFL.Var("inphase") = inphase

AFL.Var("quad") = quad

%>

p1 = atan( abs(quad+Ref(quad,-1) ) / abs(inphase+Ref(inphase,-1) ) );

phase = IIf(inphase<0 AND quad>0, 180-p1, 

IIf(inphase<0 AND quad<0, 180+p1,

IIf(inphase>0 AND quad<0, 360-p1,p1)));

dp = IIf(Ref(phase,-1)<90 AND phase>270, 360+Ref(phase,-1)-phase,Ref(phase,-1)-phase);

dp2 = IIf(dp < 1, 1, IIf(dp > 60, 60, dp));

//Graph1 = dp2;

HilbertCyclePeriod1a = dp2;

value = dp2;

HCycleCount1a=

IIf(Sum(value,6)>=360 AND Sum(value,5)<360 ,6,0) +

IIf(Sum(value,7)>=360 AND Sum(value,6)<360 ,7,0) +

IIf(Sum(value,8)>=360 AND Sum(value,7)<360 ,8,0) +

IIf(Sum(value,9)>=360 AND Sum(value,8)<360 ,9,0) +

IIf(Sum(value,10)>=360 AND Sum(value,9)<360 ,10,0) +

IIf(Sum(value,11)>=360 AND Sum(value,10)<360 ,11,0) +

IIf(Sum(value,12)>=360 AND Sum(value,11)<360 ,12,0) +

IIf(Sum(value,13)>=360 AND Sum(value,12)<360 ,13,0) +

IIf(Sum(value,14)>=360 AND Sum(value,13)<360 ,14,0) +

IIf(Sum(value,15)>=360 AND Sum(value,14)<360 ,15,0);

HCycleCount2a =

IIf(Sum(value,16)>=360 AND Sum(value,15)<360 ,16,0) +

IIf(Sum(value,17)>=360 AND Sum(value,16)<360 ,17,0) +

IIf(Sum(value,18)>=360 AND Sum(value,17)<360 ,18,0) +

IIf(Sum(value,19)>=360 AND Sum(value,18)<360 ,19,0) +

IIf(Sum(value,20)>=360 AND Sum(value,19)<360 ,20,0) +

IIf(Sum(value,21)>=360 AND Sum(value,20)<360 ,21,0) +

IIf(Sum(value,22)>=360 AND Sum(value,21)<360 ,22,0) +

IIf(Sum(value,23)>=360 AND Sum(value,22)<360 ,23,0) +

IIf(Sum(value,24)>=360 AND Sum(value,23)<360 ,24,0) +

IIf(Sum(value,25)>=360 AND Sum(value,24)<360 ,25,0);

HCyclecount3a = 

IIf(Sum(value,26)>=360 AND Sum(value,25)<360 ,26,0) +

IIf(Sum(value,27)>=360 AND Sum(value,26)<360 ,27,0) +

IIf(Sum(value,28)>=360 AND Sum(value,27)<360 ,28,0) +

IIf(Sum(value,29)>=360 AND Sum(value,28)<360 ,29,0) +

IIf(Sum(value,30)>=360 AND Sum(value,29)<360 ,30,0) +

IIf(Sum(value,31)>=360 AND Sum(value,30)<360 ,31,0) +

IIf(Sum(value,32)>=360 AND Sum(value,31)<360 ,32,0) +

IIf(Sum(value,33)>=360 AND Sum(value,32)<360 ,33,0) +

IIf(Sum(value,34)>=360 AND Sum(value,33)<360 ,34,0) +

IIf(Sum(value,35)>=360 AND Sum(value,34)<360 ,35,0);

c1= HCycleCount1a + HCycleCount2a + HCycleCount3a;

/* Graph0 = HCyclecount1a;

Graph1 = HCyclecount2a; 

Graph2 = HCyclecount3a;

Graph0Style=Graph1Style=Graph2Style=5;*/

//Graph0 = C1;

<%

c1 = AFL("c1")

c2 = c1

c3 = c1

for i = 1 to Ubound(c1)

IF c1(i) = 0 then c2(i) = c2(i-1) else c2(i) = c1(i) 

c3(i) = 0.25*c2(i) + 0.75*c3(i-1) 

next

AFL.Var("c3") = c3

%>

HilbertCyclePeriodFa = c3;

pd = int( c3);

//Graph0 = pd;

HipSum1=

(cos(0)*pr) + (cos(360*(1/pd))* Ref(pr,-1)) +

(cos(360*(2/pd))* Ref(pr,-2)) +

(cos(360*(3/pd))* Ref(pr,-3)) +

(cos(360*(4/pd))* Ref(pr,-4)) +

(cos(360*(5/pd))* Ref(pr,-5)) +

IIf(pd>6, cos(360*(6/pd))* Ref(pr,-6) ,0) +

IIf(pd>7, cos(360*(7/pd))* Ref(pr,-7) ,0) +

IIf(pd>8, cos(360*(8/pd))* Ref(pr,-8) ,0) +

IIf(pd>9, cos(360*(9/pd))* Ref(pr,-9) ,0) +

IIf(pd>10, cos(360*(10/pd))* Ref(pr,-10) ,0) +

IIf(pd>11, cos(360*(11/pd))* Ref(pr,-11) ,0) +

IIf(pd>12, cos(360*(12/pd))* Ref(pr,-12) ,0) +

IIf(pd>13, cos(360*(13/pd))* Ref(pr,-13) ,0) +

IIf(pd>14, cos(360*(14/pd))* Ref(pr,-14) ,0) ;

HipSum2=

IIf(pd>15, cos(360*(15/pd))* Ref(pr,-15) ,0) +

IIf(pd>16, cos(360*(16/pd))* Ref(pr,-16) ,0) +

IIf(pd>17, cos(360*(17/pd))* Ref(pr,-17) ,0) +

IIf(pd>18, cos(360*(18/pd))* Ref(pr,-18) ,0) +

IIf(pd>19, cos(360*(19/pd))* Ref(pr,-19) ,0) +

IIf(pd>20, cos(360*(20/pd))* Ref(pr,-20) ,0) +

IIf(pd>21, cos(360*(21/pd))* Ref(pr,-21) ,0) +

IIf(pd>22, cos(360*(22/pd))* Ref(pr,-22) ,0) +

IIf(pd>23, cos(360*(23/pd))* Ref(pr,-23) ,0) +

IIf(pd>24, cos(360*(24/pd))* Ref(pr,-24) ,0) ;

HipSum3=

IIf(pd>25, cos(360*(25/pd))* Ref(pr,-25) ,0) +

IIf(pd>26, cos(360*(26/pd))* Ref(pr,-26) ,0) +

IIf(pd>27, cos(360*(27/pd))* Ref(pr,-27) ,0) +

IIf(pd>28, cos(360*(28/pd))* Ref(pr,-28) ,0) +

IIf(pd>29, cos(360*(29/pd))* Ref(pr,-29) ,0) +

IIf(pd>30, cos(360*(30/pd))* Ref(pr,-30) ,0) +

IIf(pd>31, cos(360*(31/pd))* Ref(pr,-31) ,0) +

IIf(pd>32, cos(360*(32/pd))* Ref(pr,-32) ,0) +

IIf(pd>33, cos(360*(33/pd))* Ref(pr,-33) ,0) +

IIf(pd>34, cos(360*(34/pd))* Ref(pr,-34) ,0) ;

HrpSum1=

(sin(0)*pr) + (sin(360*(1/pd))* Ref(pr,-1)) +

(sin(360*(2/pd))* Ref(pr,-2)) +

(sin(360*(3/pd))* Ref(pr,-3)) +

(sin(360*(4/pd))* Ref(pr,-4)) +

(sin(360*(5/pd))* Ref(pr,-5)) +

IIf(pd>6, sin(360*(6/pd))* Ref(pr,-6) ,0) +

IIf(pd>7, sin(360*(7/pd))* Ref(pr,-7) ,0) +

IIf(pd>8, sin(360*(8/pd))* Ref(pr,-8) ,0) +

IIf(pd>9, sin(360*(9/pd))* Ref(pr,-9) ,0) +

IIf(pd>10, sin(360*(10/pd))* Ref(pr,-10) ,0) +

IIf(pd>11, sin(360*(11/pd))* Ref(pr,-11) ,0) +

IIf(pd>12, sin(360*(12/pd))* Ref(pr,-12) ,0) +

IIf(pd>13, sin(360*(13/pd))* Ref(pr,-13) ,0) +

IIf(pd>14, sin(360*(14/pd))* Ref(pr,-14) ,0) ;

HrpSum2=

IIf(pd>15, sin(360*(15/pd))* Ref(pr,-15) ,0) +

IIf(pd>16, sin(360*(16/pd))* Ref(pr,-16) ,0) +

IIf(pd>17, sin(360*(17/pd))* Ref(pr,-17) ,0) +

IIf(pd>18, sin(360*(18/pd))* Ref(pr,-18) ,0) +

IIf(pd>19, sin(360*(19/pd))* Ref(pr,-19) ,0) +

IIf(pd>20, sin(360*(20/pd))* Ref(pr,-20) ,0) +

IIf(pd>21, sin(360*(21/pd))* Ref(pr,-21) ,0) +

IIf(pd>22, sin(360*(22/pd))* Ref(pr,-22) ,0) +

IIf(pd>23, sin(360*(23/pd))* Ref(pr,-23) ,0) +

IIf(pd>24, sin(360*(24/pd))* Ref(pr,-24) ,0) ;

HrpSum3=

IIf(pd>25, sin(360*(25/pd))* Ref(pr,-25) ,0) +

IIf(pd>26, sin(360*(26/pd))* Ref(pr,-26) ,0) +

IIf(pd>27, sin(360*(27/pd))* Ref(pr,-27) ,0) +

IIf(pd>28, sin(360*(28/pd))* Ref(pr,-28) ,0) +

IIf(pd>29, sin(360*(29/pd))* Ref(pr,-29) ,0) +

IIf(pd>30, sin(360*(30/pd))* Ref(pr,-30) ,0) +

IIf(pd>31, sin(360*(31/pd))* Ref(pr,-31) ,0) +

IIf(pd>32, sin(360*(32/pd))* Ref(pr,-32) ,0) +

IIf(pd>33, sin(360*(33/pd))* Ref(pr,-33) ,0) +

IIf(pd>34, sin(360*(34/pd))* Ref(pr,-34) ,0) ;

pd1 = int(C3);

HTLSum1=

IIf(pd1==6, MA(pr,8),0) +

IIf(pd1==7, MA(pr,9) ,0) +

IIf(pd1==8, MA(pr, 10) ,0) +

IIf(pd1==9, MA(pr, 11) ,0) +

IIf(pd1==10, MA(pr, 12) ,0) +

IIf(pd1==11, MA(pr, 13) ,0) +

IIf(pd1==12, MA(pr, 14) ,0) +

IIf(pd1==13, MA(pr, 15) ,0) +

IIf(pd1==14, MA(pr, 16) ,0) +

IIf(pd1==15, MA(pr, 17) ,0) ;

HTLSum2=

IIf(pd==16, MA(pr,18),0) +

IIf(pd==17, MA(pr,19) ,0) +

IIf(pd==18, MA(pr, 20) ,0) +

IIf(pd==19, MA(pr, 21) ,0) +

IIf(pd==20, MA(pr, 22) ,0) +

IIf(pd==21, MA(pr, 23 ),0) +

IIf(pd==22, MA(pr, 24 ),0) +

IIf(pd==23, MA(pr, 25) ,0) +

IIf(pd==24, MA(pr, 26) ,0) +

IIf(pd==25, MA(pr, 27 ),0) ;

HTLSum3=

IIf(pd==26, MA(pr,28),0) +

IIf(pd==27, MA(pr,29) ,0) +

IIf(pd==28, MA(pr, 30) ,0) +

IIf(pd==29, MA(pr, 31) ,0) +

IIf(pd==30, MA(pr, 32) ,0) +

IIf(pd==31, MA(pr, 33) ,0) +

IIf(pd==32, MA(pr, 34),0) +

IIf(pd==33, MA(pr, 35) ,0) +

IIf(pd==34, MA(pr, 36) ,0) +

IIf(pd==35, MA(pr, 37 ),0) ;

TR = HTLSum1 + HTLSum2 + HTLSum3;

//Graph0= TR;

<%

pr = AFL("pr")

ZL = pr

for i =4 to Ubound(pr)

ZL(i) = 0.33*(pr(i) + (0.5*(pr(i) - pr(i -3)))) + 0.67 * ZL(i-1)

next

AFL.Var("ZL") = ZL

%>

graphXspace = 1;

/*Graph0 = Close;

Graph1 =TR;

Graph2 =ZL;

Graph0Style=64;

Graph1Style=Graph2Style=4;*/

/* SineWave Indicator */

cp = c3;

ip = HipSum1 + HipSum2 + HipSum3 ;

rp = HrpSum1 + HrpSum2 + HrpSum3 ;

dc1 = IIf(abs(ip)>0.001, atan(rp/ip), 90* IIf(rp>=0,1,-1));

dc2=IIf(pd<30 and cp>0, dc1 + ((6.818/cp-0.227)*360),dc1);

dc3=IIf(ip<0, dc2+270, dc2+90);

dcp=IIf(dc3>315, dc3-360, dc3);

/* Graphs of the trandline * Sinewave Indicator */
/* Plot them on different indicator windows */

/* Instantaneous Trendline Graph */

Graph0 = Close;

Graph1 =TR;

Graph2 =ZL;

Graph0Style=64;

Graph1Style=Graph2Style=4;


/* SineWave Indicator Graphs */

/* Graph0=sin(dcp);

Graph1=sin(dcp+45);*/