PureBytes Links
Trading Reference Links
|
There is nothing wrong here Alberto - you just need to understand what
the trend points function does. It plots the two points (+1 signal
for each point) on which the trend line is based. Plot this function
on a separate window for easier viewing.
jose '-)
--- In equismetastock@xxxxxxxxxxxxxxx, Menalbi <menalbi@xxxx> wrote:
> Hi,
>
> I did something wrong or the formula really has some
> mistake, and we have been mistaken, think it are in
> this part:
>
> price1:=PR;
> price2:=PR;
>
> Because when it chooses the second option in the
> variable "display" "Trend points=2"
>
> display:=Input("plot Trend line = 1, Trend points =
> 2,1,2,1");
>
> The return indicator ZERO.
>
> Alberto.
>
>
> --- Menalbi <menalbi@xxxx> escreveu:
> > > MetaStock -> Tools -> Indicator Builder -> New
> > Copy and paste formula below.
> >
> >
> > ======================
> > Trendline - adjustable
> > ======================
> > ---8<---------------------------
> >
> > { ©Copyright 2003 Jose Silva }
> >
> > pds:=
> > Input("average trend length periods",2,252,21);
> > pr:=Input("Open=1 High=2 Low=3 Close=4 Vol=5 MP=6,
> > P=7",1,7,4);
> > display:=Input("plot 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(),If(pr=7,P,C))))));
> > price1:=pr;
> > price2:=pr;
> > time1:=price1>Ref(HHV(price1,pds),-1);
> > time2:=price2<Ref(LLV(price2,pds),-1);
> >
> > {restrict to last events}
> > time1:=time1
> > AND Cum(time1)=LastValue(Cum(time1));
> > time2:=time2
> > AND Cum(time2)=LastValue(Cum(time2));
> >
> > {sort events}
> > t1pds:=LastValue(BarsSince(time1));
> > t2pds:=LastValue(BarsSince(time2));
> > x1:=If(t1pds>=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)
> >
> > ---8<---------------------------
> >
> >
> > http://users.bigpond.com/prominex/pegasus.htm
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|