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

[amibroker] Simple question



PureBytes Links

Trading Reference Links

Ed,
You could avoid your [nice] loop,

 tt = IIf(C < Ref(C,-1),1,0); 
for (i=1; i<BarCount; i++) { 
   if (tt[ i ] == 1 AND tt[ i - 1 ] >= 1) { 
      tt[ i ] = tt[ i ] + tt[ i - 1 ]; 
   } 
} 

Plot(tt,"tt",colorWhite,styleHistogram | styleThick); 
f=C<Ref(C,-1);
z=f*Sum(f,1+BarsSince(f AND Ref(f,-1)==0));
Plot(z,"z",4,1);

if this loopless solution is not complicated.

Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "ed" <ed2000nl@xxxx> wrote:
> hi,
> 
> below a little code to show consecutive down days. I need loopings 
to do this. I wonder if it would be possible to avoid the loopings 
and just use AFL array based coding to do this. Any ideas?
> 
> rgds, Ed
> 
> tt = IIf(C < Ref(C,-1),1,0); 
> 
> for (i=1; i<BarCount; i++) { 
> 
>    if (tt[ i ] == 1 AND tt[ i - 1 ] >= 1) { 
> 
>       tt[ i ] = tt[ i ] + tt[ i - 1 ]; 
> 
>    } 
> 
> } 
> 
> Plot(tt,"",colorWhite,styleHistogram | styleThick);



------------------------ 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/