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

[Metastockusers] Tendline



PureBytes Links

Trading Reference Links

This is a copy from other forum.
TDLineLow: channel created starting from 2 relative bottoms; 
TDLineHigh: channel created from 2 Highs relative; 
TDLineLow#LOG: version of TDLineLow for chart in vertical scale in 
Log; 
TDLineHigh#LOG: version of TDLineHigh for chart in vertical scale in 
Log; 

***TDLineLow***
peri:=Input("Period",2,100,4);
{by FREDCOM, 15May2003 --> V1.12}
loc:= L<Ref(LLV(L,peri),-1) AND L<=Ref(LLV(L,peri),peri);
y1t:=LastValue(ValueWhen( 2, loc=1, L ));
y2t:=LastValue(ValueWhen( 1, loc=1, L ));
x1t:=LastValue(ValueWhen( 2, loc=1, Cum(1) ));
x2t:=LastValue(ValueWhen( 1, loc=1, Cum(1) ));
{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}
yt:=(y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t; 
{yt:=at*cum(1)+bt;}
e1:=L-yt;
ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));
seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)){+peri-1});
x1:=LastValue(Cum(1)-LLVBars(Ref(e1,-ret1),seg1)-ret1);
y1:=LastValue(ValueWhen(1,x1=Cum(1),L));
ret2:=LastValue(Cum(1)-(x2t+Int(5*peri/5)));
seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5));
x2:=LastValue(Cum(1)-LLVBars(Ref(e1,-ret2),seg2)-ret2);
y2:=LastValue(ValueWhen(1,x2=Cum(1),L));
{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;}
a:=(y1-y2)/(x1-x2);
LoTL:=If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)
*x1,BarsSince(Cum(1)>x1t-5)); 
Diff:=Ref(H-LoTL,-LastValue(Cum(1)-x2));
decal:=LastValue(HHV(Diff,x2-x1));
LoTL;LoTL+decal; 

***TDLineHigh***
peri:=Input("Period",2,100,5);
{by FREDCOM, 15May2003 --> V1.12}
hic:= H>Ref(HHV(H,peri),-1) AND H>=Ref(HHV(H,peri),peri);
y1t:=LastValue(ValueWhen( 2, hic=1, H ));
y2t:=LastValue(ValueWhen( 1, hic=1, H ));
x1t:=LastValue(ValueWhen( 2, hic=1 , Cum(1) ));
x2t:=LastValue(ValueWhen( 1, hic=1 , Cum(1) ));
{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}
yt:=(y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t; 
{yt:=at*cum(1)+bt;}
e1:=H-yt;
ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));
seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)){+peri-1});
x1:=LastValue(Cum(1)-HHVBars(Ref(e1,-ret1),seg1)-ret1);
y1:=LastValue(ValueWhen(1,x1=Cum(1),H));
ret2:=LastValue(Cum(1)-(x2t+Int(4*peri/5)));
seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5));
x2:=LastValue(Cum(1)-HHVBars(Ref(e1,-ret2),seg2)-ret2);
y2:=LastValue(ValueWhen(1,x2=Cum(1),H));
{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;}
a:=(y1-y2)/(x1-x2);
HiTL:=If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)
*x1,BarsSince(Cum(1)>x1t-5)); 
Diff:=Ref(HiTL-L,-LastValue(Cum(1)-x2));
decal:=LastValue(HHV(Diff,x2-x1));
HiTL;HiTL-decal; 

***TDLineLow#LOG***
peri:=Input("Period",2,100,5);
{by FREDCOM, 15May2003 --> V1.12}
loc:= L<Ref(LLV(L,peri),-1) AND L<=Ref(LLV(L,peri),peri);
y1t:=Log(LastValue(ValueWhen( 2, loc=1, L )));
y2t:=Log(LastValue(ValueWhen( 1, loc=1, L )));
x1t:=LastValue(ValueWhen( 2, loc=1, Cum(1) ));
x2t:=LastValue(ValueWhen( 1, loc=1, Cum(1) ));
{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}
yt:=Exp((y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t); 
{yt:=exp(at*cum(1)+bt);}
e1:=L-yt;
ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));
seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)));
x1:=LastValue(Cum(1)-LLVBars(Ref(e1,-ret1),seg1)-ret1);
y1:=Log(LastValue(ValueWhen(1,x1=Cum(1),L)));
ret2:=LastValue(Cum(1)-(x2t+Int(4*peri/5)));
seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5)+Int(1*peri/5));
x2:=LastValue(Cum(1)-LLVBars(Ref(e1,-ret2),seg2)-ret2);
y2:=Log(LastValue(ValueWhen(1,x2=Cum(1),L)));
{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;}
LoTL:=Exp(If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)
*x1,BarsSince(Cum(1)>x1t-5))); 
Diff:=Ref(Log(H)-Log(LoTL),-LastValue(Cum(1)-x2));
decal:=LastValue(HHV(Diff,x2-x1));
LoTL;Exp(Log(LoTL)+decal); 

***TDLineHigh#LOG***
peri:=Input("Period",2,100,5);
{by FREDCOM, 15May2003 --> V1.12}
hic:= H>Ref(HHV(H,peri),-1) AND H>=Ref(HHV(H,peri),peri);
y1t:=Log(LastValue(ValueWhen( 2, hic=1, H )));
y2t:=Log(LastValue(ValueWhen( 1, hic=1, H )));
x1t:=LastValue(ValueWhen( 2, hic=1 , Cum(1) ));
x2t:=LastValue(ValueWhen( 1, hic=1 , Cum(1) ));
{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}
yt:=Exp((y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t); 
{yt:=at*cum(1)+bt;}
e1:=H-yt;
ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));
seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)));
x1:=LastValue(Cum(1)-HHVBars(Ref(e1,-ret1),seg1)-ret1);
y1:=Log(LastValue(ValueWhen(1,x1=Cum(1),H)));
ret2:=LastValue(Cum(1)-(x2t+Int(4*peri/5)));
seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5){+Int(1*peri/5)});
x2:=LastValue(Cum(1)-HHVBars(Ref(e1,-ret2),seg2)-ret2);
y2:=Log(LastValue(ValueWhen(1,x2=Cum(1),H)));
{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;}
HiTL:=Exp(If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)
*x1,BarsSince(Cum(1)>x1t-5))); 
Diff:=Ref(Log(HiTL)-Log( L ),-LastValue(Cum(1)-x2));
decal:=LastValue(HHV(Diff,x2-x1));
HiTL;Exp(Log(HiTL)-decal);
********************* 

*** TDLineLow Dates *** 
j:=Input("Date",1,31,15);
{by FREDCOM, 15May2003 --> V2.05}
m:=Input("Monh",1,12,1);
an:=Input("Year",1800,2200,2003);
date:=ValueWhen( 1, ((Year()-2000)*10000+Month()*100+DayOfMonth())=
((an-2000)*10000+m*100+j), Cum(1) );
peri:=Input("Période?",2,100,4);
loc:= L<Ref(LLV(L,peri),-1) AND L<=Ref(LLV(L,peri),peri) AND Cum(1)<=
(LastValue(date)-peri);
y1t:=LastValue(ValueWhen( 2, loc=1, L ));
y2t:=LastValue(ValueWhen( 1, loc=1, L ));
x1t:=LastValue(ValueWhen( 2, loc=1, Cum(1) ));
x2t:=LastValue(ValueWhen( 1, loc=1, Cum(1) ));
{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}
yt:=(y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t; 
{yt:=at*cum(1)+bt;}
{e1:=(L-yt)};
{ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1))};
{seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)))};
x1:=LastValue(Cum(1)-LLVBars(Ref({e1}(L-yt),{-ret1}-LastValue(Cum(1)-
(x1t+Int((x2t-x1t)/2)-1))),{seg1}LastValue(Int((x2t-x1t)/2+Int
(2*peri/5)))){-ret1}-LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1)));
y1:=LastValue(ValueWhen(1,x1=Cum(1),L));
ret2:=LastValue(Cum(1)-(x2t+Int(4*peri/5)));
seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5));
x2:=LastValue(Cum(1)-LLVBars(Ref({e1}(L-yt),-ret2),seg2)-ret2);
y2:=LastValue(ValueWhen(1,x2=Cum(1),L));
{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;} 
LoTL:=If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)
*x1,BarsSince(Cum(1)>x1t-5)); 
Diff:=Ref(H-LoTL,-LastValue(Cum(1)-x2));
decal:=LastValue(HHV(Diff,x2-x1));
If(Cum(1)=LastValue(date),LoTL*.98,LoTL);LoTL;LoTL+decal; 

***TDLineHigh Date***
j:=Input("Date",1,31,15);
{by FREDCOM, 15May2003 --> V2.05}
m:=Input("Monh",1,12,1);
an:=Input("Year",1800,2200,2003);
cdate:=ValueWhen( 1, ((Year()-2000)*10000+Month()*100+DayOfMonth())=
((an-2000)*10000+m*100+j), Cum(1) );
peri:=Input("Période?",2,100,4);
hic:= H>Ref(HHV(H,peri),-1) AND H>=Ref(HHV(H,peri),peri) AND Cum(1)<=
(LastValue(cdate)-peri);
y1t:=LastValue(ValueWhen( 2, hic=1, H ));
y2t:=LastValue(ValueWhen( 1, hic=1, H ));
x1t:=LastValue(ValueWhen( 2, hic=1 , Cum(1) ));
x2t:=LastValue(ValueWhen( 1, hic=1 , Cum(1) ));
{at:=(y1t-y2t)/(x1t-x2t);bt:=y1t-at*x1t;}
yt:=(y1t-y2t)/(x1t-x2t)*Cum(1)+y1t-(y1t-y2t)/(x1t-x2t)*x1t; 
{yt:=at*cum(1)+bt;}
{e1:=H-yt;}
{ret1:=LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1));}
{seg1:=LastValue(Int((x2t-x1t)/2+Int(2*peri/5)));}
x1:=LastValue(Cum(1)-HHVBars(Ref({e1}H-yt,{-ret1}-LastValue(Cum(1)-
(x1t+Int((x2t-x1t)/2)-1))),{seg1}LastValue(Int((x2t-x1t)/2+Int
(2*peri/5)))){-ret1}-LastValue(Cum(1)-(x1t+Int((x2t-x1t)/2)-1)));
y1:=LastValue(ValueWhen(1,x1=Cum(1),H));
ret2:=LastValue(Cum(1)-(x2t+Int(4*peri/5)));
seg2:=LastValue(Int((x2t-x1t)/2)+Int(4*peri/5));
x2:=LastValue(Cum(1)-HHVBars(Ref({e1}H-yt,-ret2),seg2)-ret2);
y2:=LastValue(ValueWhen(1,x2=Cum(1),H));
{a:=(y1-y2)/(x1-x2);b:=y1-a*x1;} 
HiTL:=If(Cum(1)>x1t-5,(y1-y2)/(x1-x2)*Cum(1)+y1-(y1-y2)/(x1-x2)
*x1,BarsSince(Cum(1)>x1t-5)); 
Diff:=Ref(HiTL-L,-LastValue(Cum(1)-x2));
decal:=LastValue(HHV(Diff,x2-x1));
If(Cum(1)=LastValue(cdate),HiTL*1.02,HiTL);HiTL;HiTL-decal;
******************* 

Happy Trading
Trendchaser
http://www.freewebs.com/trendchaser/


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/