PureBytes Links
Trading Reference Links
|
Roy,
Thanks! So far the formula that I have come up with doesn't quite get
it... but its close. The problem, I think, is with the slope
calculation. Should be easy enough to subtract the value of the slope
from the oldest high and plot forward but so far its eluding me. I
know that I could use an if statement but I was hoping for a variable
input.
Preston
{BarBack DescendView}
len:=Input("Periods for Ref High",1,100,20);
Signal:=Ref(H,-len);
Barbk:=Input("Barsback High",1,100,8);
Signal2:=Ref(H,-Barbk);
{Periods:=len;} {periods to display last value}
{Line Plot }
D1:=Cum(1)=LastValue(Cum(1))-LastValue(len);
{D1 is first bar of line}
D2:=Cum(1)=LastValue(Cum(1))-LastValue(len)-(barbk);
{D2 is last bar of line}
P1:=signal2; {start-of-line data array}
P2:=signal; {end-of-line data array}
V1:=ValueWhen(1,D1,P1);
V2:=ValueWhen(1,D2,P2);
B1:=LastValue(BarsSince(D1));
B2:=LastValue(BarsSince(D2));
Line:=V1-Cum(If(D1=0,(v1/v2)-(b1/b2),0));
Line:=Ref(Ref(line,-barbk),barbk); {blank end of line}
Line;
aLine:=v1-Cum(If(D1=0,(b1*v1)/(b2*v2),0));
aLine:=Ref(Ref(aline,-barbk),barbk); {blank end of line}
aLine;
--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
wrote:
> Hi Preston
>
> I have three line versions in MS. At least one of these is Jose's
and the
> other two have had some input from him. I trust you can extract
some ideas
> from one of these formulas.
>
> Roy
>
> {RL Draw Line}
> D1:= DayOfMonth()=3 AND Month()=10 AND Year()=2001; {example}
> D2:= DayOfMonth()=22 AND Month()=10 AND Year()=2001;
> P1:=C; {beginning price formula}
> P2:=C; {ending price formula}
> V1:=ValueWhen(1,D1,P1);
> V2:=LastValue(ValueWhen(1,D2,P2));
> B1:=LastValue(BarsSince(D1));
> B2:=LastValue(BarsSince(D2));
> Bp:=LastValue(B2);
> Line:=V1-Cum(If(D1=0,(V1-V2)/(B1-B2),0));
> Line:=Ref(Ref(Line,-Bp),Bp); {blank end of line}
> Line;
>
> {Draw Line Version 1.1}
> Date1:= DayOfMonth()=3 AND Month()=10 AND Year()=2001;
> Date2:= DayOfMonth()=22 AND Month()=10 AND Year()=2001;
> Date3:= DayOfMonth()=22 AND Month()=10 AND Year()=2001;
> P1:=C; {beginning price formula}
> P2:=C; {ending price formula}
> P3:=H; {ending price formula second line}
> V1:=ValueWhen(1,Date1,P1);
> V2:=LastValue(ValueWhen(1,Date2,P2));
> V3:=LastValue(ValueWhen(1,Date3,P3));
> B1:=LastValue(BarsSince(Date1));
> B2:=LastValue(BarsSince(Date2));
> B3:=LastValue(BarsSince(Date3));
> Bp:=LastValue(B2);
> Bp1:=LastValue(B3);
> Line1:=V1-Cum(If(Date1=0,(V1-V2)/(B1-B2),0));
> Line1:=Ref(Ref(Line1,-Bp),Bp);
> Line2:=V1-Cum(If(Date1=0,(V1-V3)/(B1-B3),0));
> Line2:=Ref(Ref(Line2,-Bp),Bp);
> Line1; Line2;
>
>
> {JS Draw Lines}
> {define events}
> time1:= DayOfMonth()=1 AND Month()=3 AND Year()=2001;
> time2:= DayOfMonth()=26 AND Month()=2 AND Year()=2002;
> price1:=C;
> price2:=C;
> {restrict to last events}
> time1:=time1 AND Cum(time1)=LastValue(Cum(time1));
> time2:=time2 AND Cum(time2)=LastValue(Cum(time2));
> {sort events}
> e1pds:=LastValue(BarsSince(time1));
> e2pds:=LastValue(BarsSince(time2));
> x1:=If(e1pds>e2pds,time1,time2);
> x2:=If(e1pds>e2pds,time2,time1);
> y1:=If(e1pds>e2pds,price1,price2);
> y2:=If(e1pds>e2pds,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);
> plot:=Ref(Ref(plot,-b2),b2);
> plot;
>
>
> > Roy & Scoub,
> >
> > Starting playing around with several of the formulas that Roy has
> > posted. What I have initially come up with is a horizontal view of
> > the high 20 bars ago that is constant for the next 12 bars.
Meaning
> > that the display extends from 20 bars ago to 8 bars ago and is
> > constant.
> >
> > Since the original question was for a line from one high to the
next
> > I am assuming it would be an declining trendline. To do this we
> > incorporate the slope and subtract its value from the line each
day
> > forward. This is where I'm stumped. Any suggestions?
> >
> > {BarBack View}
> > len:=Input("Periods for Ref High",1,100,20)-1;
> > Signal:=Ref(H,-len);
> > Barbk:=Input("Barsback High",1,100,8)-1;
> > Signal2:=Ref(H,-Barbk);
> > Slope:=(Signal-Signal2)/(len-Barbk);
> > Periods:=len; {periods to display last value}
> > LastBar:=Cum(1)=LastValue(Cum(1)-(Periods));
> > bacdis:=ValueWhen(1,LastBar,LastValue(Signal));
> > {blank right side of line}
> > Line:=Ref(Ref(bacdis,-Barbk),Barbk);
> > line{end}
> >
> >
> > Preston
> >
> >
> >
> > 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/
> >
> >
> >
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->
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/
|