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

Re: [amibroker] Re: please help with this code



PureBytes Links

Trading Reference Links

Are you looking for something like this:

WatchlistNumber=0;
function CountTickers( Listnum )
{
  list = GetCategorySymbols( categoryWatchlist , listnum ) ;
  Count=0;
  for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
  {
  SetForeign(sym); 
  symC = C;
  symMA = MA(C,20);  
  Count = Count + IIf( symC > symMA,1,0);  
  }
 return Count;
 } 
 
 totalissue=CountTickers(WatchlistNumber);
 Plot( totalissue, _DEFAULT_NAME(),ParamColor("Up Color",
 colorBlack ), ParamStyle( "Style", styleThick) );
 
 printf("totalissue:" + totalissue );



On Sat, Aug 23, 2008 at 1:43 PM, Waleed Khalil <waleedkhalil@xxxxxxxxx> wrote:


Thanks Grant
But i need to use the number of shares above their MA again in
the same AFL. what you did is very clever for just knowing but i
can't store that number in a variable to use in again.
i hope i can find a way of doing so.
thanks again.
cheers

Grant Noble writes:

> This code will let you explore/scan for closes above 20 SMA. Set symbols and range in AA window.
> Right-click on results and save to watchlist there. Sorry, not clever enough to do the last bit with
> AFL. G
>
> SMAbars =Param("SMA bars",20,2,200,2); // sets SMA period (default=20)
> SMA = MA( Close, SMAbars ); // store SMA of Close
> Filter = Cross ( Close, SMA ); // filter Closes above SMA (crossover)
> Buy = Filter; // add this to allow run as a scan or exploration
>
> AddColumn( Close, "Close", 5.4, colorDefault, colorDefault, 70 );
> AddColumn( SMA, "SMA(" + NumToStr(SMAbars,1.0) + ")", 5.4, colorDefault, colorDefault, 70 );
>
>
> Waleed Khalil wrote:
>> can anyone please one tell me what is wrong with the code below.
>> i need to get the number of stocks above there 20 MA.
>>
>> WatchlistNumber=0;
>> function CountTickers( Listnum )
>> {
>> list = GetCategorySymbols( categoryWatchlist , listnum ) ;
>>
>> for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
>> w=0;
>> Count=IIf(Foreign(sym,"Close") >
>> MA(Foreign(sym,"Close"),20),w+1,w);
>> {
>> if( i == 0 ) i = 0;
>> else i = i ;
>> }
>>
>> return Count;
>> }
>>
>> totalissue=CountTickers( WatchlistNumber);
>> Plot( totalissue, _DEFAULT_NAME(),ParamColor("Up Color",
>> colorBlack ), ParamStyle( "Style", styleThick) );
>>
>> printf("totalissue:" + totalissue );
>>
>> thanks in advance
>> Waleed
>> ----------------------------------------------------------
>> Send big files for free. Simple steps. No registration.
>> Visit now http://www.nawelny.com
>>
>> ------------------------------------
>>
>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> For other support material please check also:
>> http://www.amibroker.com/support.html
>> Yahoo! Groups Links
>>
>>
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com
>> Version: 8.0.138 / Virus Database: 270.6.7/1628 - Release Date: 8/22/2008 6:32 PM
>>
>>
>>

----------------------------------------------------------
Send big files for free. Simple steps. No registration.
Visit now http://www.nawelny.com


__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___