MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Half a line is fine Trendline System
Re: the Half a line is fine Trendline

· To: metastock@xxxxxxxxxxxxx
· Subject: Re: the Half a line is fine Trendline
· From: wander@xxxxxxxx
· Date: Thu, 21 Oct 1999 12:32:03 -0400
· References: <380E3981.863B57D9@xxxxxxxx>
· Sender: owner-metastock@xxxxxxxxxxxxx

This should plot an arrow when a close crosses trendline. You'll need to write your own exit.

Regards,
Ken

Half a line is fine Trendline System

Enter Long:

{n=Zig Zag indicator points}
n:=.80{pts};
aPeak:=
Zig(H,n,\$)>Ref(Zig(H,n,\$),-1) AND
Zig(H,n,\$) >Ref(Zig(H,n,\$),1{future});
bbp:=If(bsp=0,Ref(bsp,-1)+1,bsp);
ppmp:=ValueWhen(2,bsp=0,H)-
ValueWhen(1,bsp=0,H);
ROCbp:=ValueWhen(1,bsp=0,ppmp/bbp);
PeakTrendline:=
If(Ref(bsp,-1)=1 AND aPeak=1,
ValueWhen(1,Ref(bsp,-1)=1,
Ref(H,-2))-bbp*Ref(ROCbp,-1),
If(bsp=1,
ValueWhen(1,bsp=1,Ref(H,-1))-bbp*ROCbp,
ValueWhen(1,bsp=2,Ref(H,-2))-
bbp*Ref(ROCbp,-1)));

Cross(C,PeakTrendline) AND
PeakTrendline<=Ref(PeakTrendline,-1)
AND
{peak locked-in.}
Ref(LowestSince(1,aPeak=1,H),-1)<=
Ref(ValueWhen(1,aPeak=1,H),-1)-n;

Enter Short:

{n=points}
n:=.80{pts};
aTrough:=
Zig(L,n,\$)<Ref(Zig(L,n,\$),-1) AND
Zig(L,n,\$)<Ref(Zig(L,n,\$),1{future});
bbt:=
If(bst=0,Ref(bst,-1)+1,bst);
ptmt:=ValueWhen(2,bst=0,L)-ValueWhen(1,bst=0,L);
ROCbt:=ValueWhen(1,bst=0,ptmt/bbt);
TroughTrendline:=
If(Ref(bst,-1)=1 AND aTrough=1{true},
ValueWhen(1,Ref(bst,-1)=1,
Ref(L,-2))-bst*Ref(ROCbt,-1),
If(bst=1,ValueWhen(1,bst=1,Ref(L,-1))-bst*
ROCbt,ValueWhen(1,bst=2,Ref(L,-2))-bbt*
Ref(ROCbt,-1)));

Cross( TroughTrendline,C) AND
TroughTrendline>=Ref(TroughTrendline,-1)
AND
{trough locked-in}
Ref(HighestSince(1,aTrough=1,L),-1)>=
Ref(ValueWhen(1,aTrough=1,L),-1)+n;

Source / From: TOP
http://purebytes.com/archives/metastock/

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.