Bruce, I have problems getting this AFL to do the job.
I confirm having done the following

>ListAvg.afl in "include" folder
>saved the atc afl into custom folder. Can see it in my charts tab. also can
see atc in group 253.
>opened blank chart - File>new>blank Chart
> Run listavg.afl from charts tab and changed parameters with WL number and
clicked calculate
All I can see is a flat line at a NON-ZERO value
I have tried both with the original ATC formula, as well as the tweak you
provided that calls names atc with watchlist name, rather than wlnum.
Any ideas on what i am doing wrong?


On 18 March 2010 14:41, furinkazaan <[email protected]> wrote:

> this is a free code project that Bruce posts in the free Library on the
> Amibroker University.
> http://www.amibrokeru.com/FreeLibrary/FreeCode
>
>
> On 1 January 2010 13:28, Gordon <[email protected]> wrote:
>
>>
>>
>> I m trying to follow this thread with some difficulty. I cannot find any
>> reference to ListAvg.afl anywhere is the literature. Would you please tell
>> me where it can be located.
>>
>> Thanks
>>
>>
>> --- In [email protected] <amibroker%40yahoogroups.com>, "Bruce"
>> <bru...@...> wrote:
>> >
>> > I'm buried in some end of the year paperwork right now, but let me offer
>> a couple of quick comments.
>> >
>> > 1. The dropdown list of names is in the expanded version that I plan to
>> put in the subscriber area along with some other functions related to
>> portfolio mixes, such as percentage allocations, re-balance intervals, etc.
>> My long-term intent is really to offer "starter" examples in the FREE CODE
>> area that users can expand on. We want to concentrate on breadth of topics
>> there.
>> >
>> > 2. One simple tip that might help deal with WL numbers in many places is
>> to name your watchlist to their number plus that name. That will make the
>> numbers easier to find in a long list of names in the watchlist tree. For
>> example, my watchlist 13 is named "13 - Select".
>> >
>> > 3. Lastly, the ATC should be going into Group 253 since atcFlagDefaults
>> was used in the ATC call in the example that I posted. I may have misread
>> your note, but it seemed to say that you believe are seeing it in the
>> watchlist. As far as what the ATC is named, you can use the name instead of
>> the number by changing the AddtoComposite statement to the following -
>> >
>> > AddToComposite( Lavg, "~ListAvg_" + CategoryGetName( categoryWatchlist,
>> wlnum ),
>> > "X", atcFlagDefaults + atcFlagEnableInIndicator );
>> >
>> >
>> > -- BruceR
>> >
>> >
>> > --- In [email protected] <amibroker%40yahoogroups.com>,
>> furinkazaan <furinkazaan@> wrote:
>> > >
>> > > Bruce, I notice that the parameters use a WLNUMfor a watch list
>> number.
>> > > Since I intend to run this on many sectoral watchlists, I wonder if we
>> can
>> > > show the 'Watchlist Name' instead of/ in addition to WL NUM? Can the
>> > > Parameters dialog be coded to offer a drop-down list of all watchlists
>> to
>> > > the current market? Can the LAVG be defined to show "~ListAVg" +
>> Watchlist
>> > > Name?
>> > >
>> > > while its fantastic that each atc is written ijnto the watchlist
>> folder for
>> > > which it is computed, if I got them all into 1 group to check, say
>> relative
>> > > performance, then I'd have trouble identifying eact atc by just the WL
>> Num.
>> > >
>> > > can you help? Best wishes for a great year ahead!
>> > >
>> > >
>> > > 2009/12/11 furinkazaan <furinkazaan@>
>> > >
>> > > > Thanks very much Bruce. I intend to set this up over the weekend.
>> I'll
>> > > > report progress.
>> > > >
>> > > > 2009/12/9 Rick Osborn <ricko@>
>> > > >
>> > > >
>> > > >>
>> > > >>
>> > > >>
>> > > >> changed the AA range and ran a dummy scan. That did the trick
>> > > >> Thanks
>> > > >>
>> > > >>
>> > > >> ------------------------------
>> > > >> *From:* Bruce <brucer@>
>> > > >> *To:* [email protected] <amibroker%40yahoogroups.com>
>> > > >> *Sent:* Tue, December 8, 2009 8:16:46 PM
>> > > >>
>> > > >> *Subject:* [amibroker] Re: AmibrokerU Update
>> > > >>
>> > > >>
>> > > >>
>> > > >> Rick -
>> > > >>
>> > > >>
>> > > >> Not much info, so I can't be sure. A SWAG would be to check the
>> From/To
>> > > >> range in the AA window. As I noted in the original article, I used
>> the
>> > > >> existing AA user interface as an easy way to control the range. If
>> that is
>> > > >> it, you can change the AA range and run a dummy scan to "set it".
>> Or, you
>> > > >> might want to look at the ListAvg AFL code for a comment that notes
>> that a
>> > > >> variable called "bir" can be set to 1 to use all bars by default.
>> > > >>
>> > > >> -- Bruce
>> > > >>
>> > > >> --- In amibro...@yahoogrou ps.com <amibroker%40yahoogroups.com>,
>> Rick
>> > > >> Osborn <ricko@> wrote:
>> > > >> >
>> > > >> > Bruce
>> > > >> > All the values in all the watchlists are 1000.
>> > > >> > What am I doing wrong?
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> > ____________ _________ _________ __
>> > > >> > From: Bruce <brucer@>
>> > > >> > To: amibro...@yahoogrou ps.com <amibroker%40yahoogroups.com>
>> > > >>
>> > > >> > 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 <furinkaz...@...>
>> > > >> 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 brucer@
>> > > >> > >
>> > > >> > > >
>> > > >> > > >
>> > > >> > > > 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\
>>  <http://www>> > >> <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
>> > > >> > > >
>> > > >> > > >
>> > > >> > > >
>> > > >> > >
>> > > >> >
>> > > >>
>> > > >>
>> > > >>
>> > > >
>> > > >
>> > >
>> >
>>
>>  
>>
>
>

Reply via email to