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

[amibroker] Re: Strange Array



PureBytes Links

Trading Reference Links

Bernard,

when you do this: Nb = Nb + X,
x must never be an empty value because Nb + Null is Null. You want x 
to be 0 in these cases, thats what the Nz function does. 
Try Nb = Nb + Nz( X );

Johan



--- In amibroker@xxxxxxxxxxxxxxx, Bernard Bourée <bernard@xxxx> 
wrote:
> Hello
> 
> I have the code hereafter
> I want to find how many stocks within my first WL, have their MA
(6) of 
> the RSI(14) above the MA(20) of the same RSI(14)
> I use iTest to stop the loop a a define count.
> With small iTest (0 to 5) I have the array Nb which works but is 
getting 
> smaller and smaller ( I mean with less and less bars) and with the 
full 
> number of stocks the Nb is EMPTY.
> I suspect that is due to the fact that the bars numbers are 
different 
> from one stock to the other.
> Does someone knows what happen when the line Nb = Nb + X is 
performed 
> and the length of Nb and X are different ?
> Maybe I have to code a loop for each bar ?!
> 
> Thanks for your help.
> 
> Bernard
> 
> iTest = 8;
> Liste = CategoryGetSymbols( categoryWatchlist, 0);
> Nb[0]=0;
> for( i = 0; i < iTest AND ( Sym = StrExtract( Liste, i ) ) != ""; 
i++ )
> {
>     Cl = Nz(Foreign( Sym, "C" ));
>      RS = RSIa(Cl,14);
>      Nb = Nb + (MA(RS, 6)> MA(RS, 20));
> }
> Plot(Nb*10, "Nb", colorGreen);




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/