Trendlines This indicator is from jose Silva {Trendline - adjustable} {©Copyright 2003 Jose Silva} pds:= Input("average trend length periods",2,252,21); pr:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 MP=6",1,6,4); display:=Input("Trend line = 1, Trend points = 2",1,2,1); {define events} pr:=If(pr=1,O,If(pr=2,H,If(pr=3,L,If(pr=5,V, If(pr=6,MP(),C))))); price1:=pr; price2:=pr; time1:=price1>Ref(HHV(price1,pds),-1); time2:=price2=t2pds,time1,time2); x2:=If(t1pds>=t2pds,time2,time1); y1:=If(t1pds>=t2pds,price1,price2); y2:=If(t1pds>=t2pds,price2,price1); {fix coordinates} y1:=ValueWhen(1,x1,y1); y2:=LastValue(ValueWhen(1,x2,y2)); b1:=LastValue(BarsSince(x1)); b2:=LastValue(BarsSince(x2)); plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2); If(display=1,plot,Time1+Time2) *****Trendlines S&R***** This indicator is from Victor H ppr:=Input("Longest=4,Longer=3,Long=2,Med=1,Short=.5",0.5,4,2); pps:=Input("Longest=4,Longer=3,Long=2,Med=1,Short=.5",0.5,4,2); z1:= Cum(Log(If(If(MP()>=Ref(MP(),-1),ATR(1),0)>0,ATR(1),H)/H))/Max(1,Cum(If(If(MP()>=Ref(MP(),-1),ATR(1),0)>0,1,0))); r1:= LastValue(100*Exp(LastValue(z1)))*ppr; r2:= LastValue(Peak(1,H,r1))- LastValue(Peak(2,H,r1)); r3:= LastValue(PeakBars(2,H,r1))-LastValue(PeakBars(1,H,r1)); r4:= r2/r3; {Slope} r6:= LastValue(Cum(1)- PeakBars(2,H,r1)); r7:= LastValue(Peak(2,H,r1))+(r4*( Cum(1)-r6)); r8:=If(Cum(1)=r6),r7); z2:= Cum(Log(If(If(MP()<=Ref(MP(),-1),ATR(1),0)>0,ATR(1),L)/L))/Max(1, Cum(If(If(MP()<=Ref(MP(),-1),ATR(1),0)>0,1,0))); s1:= LastValue(100*Exp(LastValue(z2)))*pps; s2:= LastValue(Trough(1,L,s1))- LastValue(Trough(2,L,s1)); s3:= LastValue(TroughBars(2,L,s1))-LastValue(TroughBars(1,L,s1)); s4:= s2/s3; {Slope} s6:= LastValue(Cum(1)- TroughBars(2,L,s1)); s7:= LastValue(Trough(2,L,s1))+(s4*( Cum(1)-s6)); s8:=If(Cum(1)=s6),s7); R8;S8; *****Trendlines Resistance***** This indicator is from Victor H {Resistance Trendlines} pp:= Input("Long = 2,Med = 1,Short = 0.5", 0.5,6,2); x0:= If(MP()>=Ref(MP(),-1),ATR(1),0); y0:= Cum(If(x0>0,1,0)); z1:= If(x0>0,ATR(1),HIGH); z2:=Log(z1/HIGH); z3:= Cum(z2)/Max(1,y0); z4:= 100*Exp(LastValue(z3)); a1:= LastValue(z4)*pp; a2:= LastValue(Peak(1,H,a1)); a3:= LastValue(Peak(2,H,a1)); a4:= a2-a3; a5a:=PeakBars(2,H,a1); a5b:=PeakBars(1,H,a1); a5:= LastValue(a5a)-LastValue(a5b); a6:= a4/a5; {Slope} a7:= LastValue(Cum(1)-a5b); a8:= LastValue(Cum(1)-a5a); a9:= Cum(1); a10:=a3+(a6*(a9-a8)); a11:=If(a9=a8),a10); a11; *****Trendlines Support ***** This indicator is from Victor H pp:= Input("Long = 2,Med = 1,Short = 0.5", 0.5,4,2); x0:= If(MP()<=Ref(MP(),-1),ATR(1),0); y0:= Cum(If(x0>0,1,0)); z1:= If(x0>0,ATR(1),LOW); z2:=Log(z1/LOW); z3:= Cum(z2)/Max(1,y0); z4:= 100*Exp(LastValue(z3)); a1:= LastValue(z4)*pp; a2:= LastValue(Trough(1,L,a1)); a3:= LastValue(Trough(2,L,a1)); a4:= a2-a3; a5a:=TroughBars(2,L,a1); a5b:=TroughBars(1,L,a1); a5:= LastValue(a5a)-LastValue(a5b); a6:= a4/a5; {Slope} a7:= LastValue(Cum(1)-a5b); a8:= LastValue(Cum(1)-a5a); a9:= Cum(1); a10:=a3+(a6*(a9-a8)); a11:=If(a9=a8),a10); a11;