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

Re: [amibroker] Re: Strange Array



PureBytes Links

Trading Reference Links

Thanks Johan

Bernard

johsun a écrit :
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);



-- 
Bernard Bourée
bernard@xxxxxxxxxx
Mob: +33 6 09 11 05 91 


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