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

Re: [amibroker] How to get non array variables?



PureBytes Links

Trading Reference Links

Below is an alternative way to calculate this line. This method 
gives us a continous array that can be used in further calculations 
( just remember that it looks into the future, similar to a Zig 
line).

Regards,
Johan

//--------------------------------------------------------
SetBarsRequired(1000,1000);
z=x0=x1=y0=y1=Null;
Cond=Cross(StochD(),70);// the condition
for(i=0;i<BarCount;i++)
{
if(Cond[i])
 {
 x0=x1; y0=y1; x1=i; y1=H[i];
 s=LineArray(x0,y0,x1,y1); 
 for(j=x0;j<=x1;j++) z[j]=s[j];
 }
}
Plot(C,"",colorDefault,styleCandle);
Plot(z,"",colorGreen,styleLine);
//--------------------------------------------------------


--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> wrote:
> In many codes we want to draw a line linking various points of a 
> graph.
> These points are usually following a binary condition.
> A general solution is
> 
> // Conditional LineArray() application
> Plot(H,"",1,styleNoLine); 
> Plot(C,"C",1,64);
> Cond=Cross(StochD(),70);// the condition
> PlotShapes(Cond*shapeDownTriangle,colorYellow);
> n=Cum(Cond);nmax=LastValue(n);x=BarIndex();
> for(j=1;j<nmax;j++)
> {
> x1=LastValue(ValueWhen(n==j AND n>Ref(n,-1),x));
> x2=LastValue(ValueWhen(n==j+1 AND n>Ref(n,-1),x));
> y1=H[x1];
> y2=H[x2];
> Plot(LineArray(x1,y1,x2,y2),"",colorYellow,1);
> }
> 
> In this example we link the H for the Cross(StochD(),70) points.
> Dimitris Tsokakis



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/