Hello (Tim?). Would these speculative ideas help?
1. For a database subset (watchlist etc) that is constant for the period: create a composite (as per Graham's or other code in recent composite posts except without the averaging component); and then divide ROC(~composite,periods) by periods to standardise the composite to % per bar (day, week?). That would give you a standardised composite 'momentum' type indicator for your watchlist etc. I don't know if I would describe it as 'unweighted' as it is monentum biased but it might be 'unweighted' by your definition. If you want to do it for a complete database you can create the composite without looping etc and use ROC/periods in the same way. 2. For a rotating subset, say a watchlist, create a composite for the 'current' bar (day, week, month etc), (without the averaging component); perform an ROC(~periodcomposite,1) = PC, and then create your running watchlist composite of the period result ATC(PC etc) over the bar range that interests you. There is no need to give any consideration to averaging as the ~watchlist has already been standardised to % per period basis. The ROC% composite index is also zerobased for any range so there is no need to set and maintain an intitial stating or 'base'value. If the criteria for rotating symbols in and out of the watchlist is constant over time then method 2 would be going awfully close to being a pseudo backtester with the 'composite' plot analagous to an equity curve, wouldn't it? An interesting conceptual extrapolation of that idea would be to replace the 'watchlist' with a set of trading rules which would create a dynamic composite 'on the fly'. (I think that idea or somethng like it has been talked about somewhere else in AB; maybe by Tomasz?) As I can barely write a line of code to save myself I can't help with specific code or any further clarification. I have just offered my comments as a starting point for one possible solution or maybe as an interesting discussion piece. BrianB2. --- In [email protected], "timgadd" <[EMAIL PROTECTED]> wrote: > > After spending MUCH time searching, I have found this topic started > many times in the group archive, but i've never seen a final solution > given in AFL. I would greatly appreciate assistance with the AFL code > or reference to a prior solution. > > The standard AddToComposite function produces a "price weighted" > composite. For analyzing the breadth of a sector, for > instance, "unweighted" composites are more appropriate and revealing. > I have seen the term "equal weighted" used for what i am calling > an "unweighted" composite, so i will explain in boring detail what i > am looking for just to be clear. > > By unweighted composite, i refer to one that is produced by > calculating an arithmetic or geometric average of the day to day % > change for each component, so that each component has equal weight > (no weighting is introduced by the calculation). I am interested in > the arithmetic average - the simplest form, but i don't know how to > initialize the starting value and then cumulate(?) the successive % > change averages for the open, high, low, close (volumes are simply > added). I have seen references regarding problems with averaging > values for high and low for this type of composite, so if necessary, > a composite calculated on the close only will suffice. I am only > interested in the average changes between end-of-day values, but > would like to produce candlesticks of the composites if possible. > > Assuming closing values only, each composite will start with an > initial value (like 100) and then, for each day, the average of all > the %changes (from the previous day) will be added to the preceding > value. Using a simple 3 component composite as an example, assume for > the second value of the composite (remember the first value will be > 100), we have the following %changes. > > Component1 = +1.2% > Component2 = +2.4% > Component3 = -1.7% > > So the first day's average %change = ( 0.012 + 0.024 - 0.017 ) / 3 > > 100 + ((0.012 + 0.024 - 0.017) / 3) + (the next day's average % > change) + ... > > The component values for volume are just added (or averaged) to get > the daily values. > > TIA for any help. > 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 Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
