| 
 PureBytes Links 
Trading Reference Links 
 | 
OK, I think I get it. Is this what you're looking for?
Johan
Plot(C,"",colorGreen,styleBar);
pivotlow = Ref(L,-1)>L AND L<Ref(L,1);
x1=LastValue(ValueWhen(pivotlow,Cum(1)-1,1));
y1=LastValue(ValueWhen(pivotlow,L,1));
x0=LastValue(ValueWhen(pivotlow AND L<y1,Cum(1)-1,1));
y0=LastValue(ValueWhen(pivotlow AND L<y1,L,1));
Line=LineArray(x0,y0,x1,y1,1);
Plot(Line,"",colorBlue,styleLine|
styleThick|styleNoRescale|styleNoLabel);
PlotShapes((Cum(1)-1==x0 OR Cum(1)-1==x1)
*shapeSmallCircle,colorBlue,0,L);
PlotShapes((Cross(Cum(C<Line AND Cum(1)-1>x1),0))
*shapeDownArrow,colorRed,0,H);
Title="TD Demand Line";
GraphXSpace=4;
--- In amibroker@xxxxxxxxxxxxxxx, "marmal417" <marmal@xxxx> wrote:
> Thank you very much, Johan. I replaced all the SelectedValue with 
> Lastvalue to only get the most recent trendline. I think your 
formula 
> does exactly what I described. However, after looking at some 
charts 
> I realised my description was a bit wrong. You see, there should 
> always be a demand line (upward sloping line) connecting the most 
> recent pivot with the second most recent pivot that is also lower 
> than the most recent. This code compares the two most recent 
> pivotpoints and if the second most recent is greater than the most 
> recent, then no line is drawn. What it really should do is first 
> identify the most recent pivot, and then go back and look for the 
> next pivot that is lower and connect those two with a line, 
wherever 
> that next pivot is. The exception is when a stock makes a new all 
> time low, because then no lower pivot point can exist to draw a 
line 
> from.  
> 
> Maybe this requires a lot more programming, but can it be done?
> 
> So far I think it's a great start!
> //Martin
------------------------ 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/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links
<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 
 |