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

[amibroker] Re: please help with this code



PureBytes Links

Trading Reference Links

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
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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