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

[amibroker] One stock in two groups



PureBytes Links

Trading Reference Links

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

--- In amibroker@xxxxxxxxxxxxxxx, "johsun" <johanskatt@xxxx> wrote:
> Small correction:
> 
> Plot(C,"",colorGreen,styleBar);
> 
>  pivotlow = Ref(L,-1)>L AND L<Ref(L,1);
>  y0=SelectedValue(ValueWhen(pivotlow,L,2));
>  y1=SelectedValue(ValueWhen(pivotlow,L,1));
>  x0=SelectedValue(ValueWhen(pivotlow,Cum(1)-1,2));
>  x1=SelectedValue(ValueWhen(pivotlow,Cum(1)-1,1));
>  Cond=y1>y0;
>  Line=LineArray(x0,y0,x1,y1,1);
>  Plot(IIf(Cond,Line,Null),"",colorBlue,styleLine|
>  styleThick|styleNoRescale|styleNoLabel);
>  PlotShapes((Cum(1)-1==x0 OR Cum(1)-1==x1)
>  *shapeSmallCircle,colorBlue,0,L); 
>  PlotShapes((cond AND Cross(Cum(C<Line AND Cum(1)-1>x1),0))
>  *shapeDownArrow,colorRed,0,H);
>  
> 
> Title="TD Demand Line";
> GraphXSpace=4;
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "johsun" <johanskatt@xxxx> wrote:
> > Hi,
> > 
> > Here's my take on it.
> >  Problem with LineArray function is that it only takes numbers 
not 
> > arrays thus cannot be backtested (at least I don't thick it can). 
> > Input has to be LastValue or SelectedValue.
> > 
> > The code:
> >  
> > Plot(C,"",colorGreen,styleBar);
> > 
> >  pivotlow = Ref(L,-1)>L AND L<Ref(L,1);
> >  y0=SelectedValue(ValueWhen(pivotlow,L,2));
> >  y1=SelectedValue(ValueWhen(pivotlow,L,1));
> >  x0=SelectedValue(ValueWhen(pivotlow,Cum(1)-1,2));
> >  x1=SelectedValue(ValueWhen(pivotlow,Cum(1)-1,1));
> >  Cond=y1>y0;
> >  Line=LineArray(x0,y0,x1,y1,1);
> >  Plot(IIf(Cond,Line,Null),"",colorBlue,styleLine|
> >  styleThick|styleNoRescale|styleNoLabel);
> >  PlotShapes((Cum(1)-1==x0 OR Cum(1)-1==x1)
> >  *shapeSmallCircle,colorBlue,0,L); 
> >  PlotShapes((cond AND Cross(Cum(C<Line),0) AND Cum(1)-1>x1)
> >  *shapeDownArrow,colorRed,0,H);
> >  
> > 
> > Title="TD Demand Line";
> > GraphXSpace=4;
> > 
> > Johan



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/