Bruce All the values in all the watchlists are 1000. What am I doing wrong?
________________________________ From: Bruce <[email protected]> To: [email protected] Sent: Tue, December 8, 2009 2:28:20 PM Subject: [amibroker] Re: AmibrokerU Update Sure, I'll give a (hopefully) useful example. And, I'll try to do more of this, where possible, in the future. In order to facilitate this, though, it is best to use a Chart Template, Complete file and record a generic procedure for how to use it. Rather than introduce that now, I'll walk you through a manual install. So, download the ListAvg.afl file to your include directory. If you have done a stock install, it will be at C:\Program Files\Amibroker\ Formulas\ Include. You can verify this by selecting the Tools / Preferences menu and then the AFL tab. The standard include path will be the first Pick button. Now, take the following code and either save it in your Custom formulas directory, or enter it into the code editor. The editor can be launched from the Analysis / Formula Editor menu. Once it is copied into the editor, you can use the Tools / Insert Chart menu to get a chart. This indicator uses parameters to select a watchlist to perform the ListAvg on. Right click on the chart and select parameters. You will need to enter a watchlist number. When ready, click the Calculate parameter button to perform the calculation. Since this can be lengthy, it is only done on user action. But, it is written to an AddtoComposite ticker ("~ListAvg" + number) for each watchlist, and simply read thereafter. #include <ListAvg.afl> wlnum = Param( "Watchlist", 13, 1, 100, 1 ); trig = ParamTrigger( "Calculate", "CLICK" ); Lavg = Nz( Foreign( "~ListAvg" + wlnum , "C" ) ); if ( trig ) { Lavg = ListAvg( CategoryGetSymbols( categoryWatchlist, wlnum ) ); AddToComposite( Lavg, "~ListAvg" + wlnum, "X", atcFlagDefaults + atcFlagEnableInIndi cator ); } Plot( Lavg, "Watchlist " + wlnum + " ListAvg", colorDefault ); Lastly, since you mentioned sector averages - I'll mention one example use from my experience. Technology averages do not typically indicate the health of innovative small-cap tech stocks. The averages are driven by Intel, Microsoft, etc. An average of targeted, innovative small-cap tech companies in a watchlist can be more useful for stock investing. Hope that helps. -- Bruce --- In amibro...@yahoogrou ps.com, furinkazaan <furinkazaan@ ...> wrote: > > Bruce, thanks for the afl. It comes at the most oppurtune time when I'm > considering creation of many sectoral indices. However, rookie that I am, I > am not able to figure out how to use the AFL. I would appreciate a > step-by-step detail on how to use it, including where to copy the afl, where > to store the csv list of tickers etc., and how to run it.. Can the afl be > pointed to a watchlist instead of a csv file of tickers? > > Thanks again. > > > 2009/11/18 Bruce bru...@... > > > > > > > Quick update - I've added a Free Code module and Free Code article to > > AmibrokerU called ListAvg. For those who need for an equal weighted > > average of a list of tickers, the Code module provides a function that > > implements the result in a single call. If you are interested in the > > background on the need for this function, and the problem with other > > types of index and list averages, the article should be of interest. > > Here are the links (sorry they are long, I'll fix that soon) - > > > > http://www.amibroke ru.com/FreeLibra ry/FreeCode/ tabid/99/ articleType/ Arti\ \ > > cleView/articleId/ 109/ListAvg- ndash-A-Function -to-Calculate- an-Equal- Wei\ \ > > ghted-Average- of-a-List- of-Tickers. aspx<http://www.amibroke ru.com/FreeLi\ brary/FreeCode/ tabid/99/ articleType/ ArticleView/ articleId/ 109/ListAvg- nd\ ash-A-Function- to-Calculate- an-Equal- Weighted- Average-of- a-List-of- Ticke\ rs..aspx> > > > > http://www.amibroke ru.com/FreeLibra ry/FreeArticles/ tabid/63/ articleType/ \ \ > > ArticleView/ articleId/ 110/ListAvg- ndash-Uses- and-Example. aspx<http://www\ .amibrokeru. com/FreeLibrary/ FreeArticles/ tabid/63/ articleType/ ArticleVie\ w/articleId/ 110/ListAvg- ndash-Uses- and-Example. aspx> > > > > As we prepare to open up subscriptions to AmibrokerU soon, I've received > > some questions about what types of free and subscription content that we > > plan to add. In general, we will offer "lite" of "subset" versions of > > premium code and articles available in the subscription sections. > > ListAvg is an example of that. It implements an equal weighted average > > of a CSV list, and is effectively re-balanced daily. Plans call for a > > full-featured routine in the subscription section called WtMixRebal that > > implements weighed averages that can be re-balanced at different periods > > or based upon a signal. This module is useful for index averages as > > well as portfolio modeling of a weighted list of tickers with shorting > > and margin with a fast, single function call. > > > > In addition to educational articles, I'm going to try to cover broader > > topics of applications, with examples, that I've found useful. In that > > spirit, the next topic will be about connecting to Excel and > > manipulating spreadsheets, charts, and data. That may seem a little > > odd, but there are many uses for such an interface - both for input to > > and output from Amibroker. For example - summary bar charts, command > > button trading control, etc. More later .... > > > > -- BruceR > > > > > > >
