PureBytes Links
Trading Reference Links
|
Johan
Yes Nb was initialzed before the loop but with Nb=0.
Yes the wtachlist is populated.
But I still have a problem with Nb since it is always 0.
Nb is the number of stocks having their Close higher than MA(20) so it
should be an array.
So I have modified my code with nb=[0]
But it still don'tworks.
How can I check the array Nb ?
I have tried with _TRACE but it only give one value.
Thanks for your help
Berrnard
johsun a écrit :
Bernard,
Two things,
1. The code will give an error if you don't initialize nb. I assume
you're doing that outside the loop so it doesn't get reset to zero
on each iteration...
2. Is watchlist 0 populated?
This works on my computer:
nb = 0;
Liste = CategoryGetSymbols( categoryWatchlist, 0 );
for( i = 0; ( Sym = StrExtract( Liste, i ) ) != ""; i++ )
{
f = Foreign( Sym, "C" );
MMA = MA(f, 20);
nb = nb + (f> MMA);
}
Johan
--- In amibroker@xxxxxxxxxxxxxxx, Bernard Bourée <bernard@xxxx>
wrote:
> I want to build an operator calculated as being the number of
stocks in
> a given WatchList having their Close higher than their MA on 20
days
> My code always return nb=0
>
> Liste = CategoryGetSymbols( categoryWatchlist, 0 );
> for( i = 0; ( Sym = StrExtract( Liste, i ) ) != ""; i++ )
> {
> f = Foreign( Sym, "C" );
> MMA = MA(f, 20);
> nb = nb + (f> MMA);
> }
>
> Thanks for your help
>
> --
> Bernard Bourée
> bernard@xxxx
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
--
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
---- LSpots keywords ?>
---- HM ADS ?>
YAHOO! GROUPS LINKS
|
|