Mike, Great job well done. I'm ecstatic over what you've done, as I've been looking for this for several weeks. More later.
Dick Hoierman --- In [email protected], "Mike" <[EMAIL PROTECTED]> wrote: > > The following code should give you an almost exact match to your > sample table. > > Pre-flight: > - Modify the formula below to substitute the name of the index symbol > based on your data provider (e.g. change "SP-500" to "^NDX"). > > - Set up a watch list holding the symbols you want to work with, > including the index itself. > > Exploration: > - In the AA window, set the filter to be your watchlist > - Set "n last days" to 1 > - Click the "Explore" button. > > Mike > ---- > > IndexName = "SP-500"; > > SetForeign(IndexName); > IndexClose = Close; > IndexOldClose = Ref(Close, -20); > IndexPctDiff = IIF(IndexClose > IndexOldClose, > (IndexClose/IndexOldClose - 1) * 100, (1 - IndexClose/IndexOldClose) > * -100); > RestorePriceArrays(); > > OldClose = Ref(Close, -20); > PctDiff = IIF(Close > OldClose, (Close/OldClose - 1) * 100, (1 - > Close/OldClose) * -100); > > Filter = 1; > > SetOption("NoDefaultColumns", True); > AddTextColumn(Name(), "Sym"); > AddColumn(Close, "PR"); > AddColumn(OldClose, "PR-20"); > AddColumn(Close - OldClose, "$Diff"); > AddColumn(PctDiff, "%Diff", 2.2); > AddColumn(PctDiff - IndexPctDiff, "%STKvsIDX", 2.2); > SetSortColumns(1); > > --- In [email protected], "areehoi" <areehoi@> wrote: > > > > > > I've been attempting to find a formula (Exploration) the will show > > the relative performance of a Stock vs an Index or other indicator. > > I've searched the AB Library , files section and Yahoo AB group but > > no luck. If someone has such a formula/exploration It would be most > > appreciated if you would post or pass along. Below is a > spreadsheet of > > what I'm tying to achieve. It is for 20 bars of the Nasdaq100 (^NDX) > > vs some of the stocks in that list. Thanks for any ideas or help > you may > > offer. > > > > > > > > Dick H. > > > > > > > > Sym > > > > PR > > > > PR-20 > > > > Diff$ > > > > %Diff > > > > % STKvsIDX > > > > ^NDX > > > > 1972.54 > > > > 1997.02 > > > > -$24.48 > > > > -1.23% > > > > > > > > AAPL > > > > $185.64 > > > > $188.16 > > > > -$2.52 > > > > -1.34% > > > > -0.11% > > > > ADBE > > > > $41.74 > > > > $40.44 > > > > $1.30 > > > > 3.21% > > > > 4.44% > > > > ADSK > > > > $39.9 > > > > $39.67 > > > > $0.23 > > > > 0.58% > > > > 1.81% > > > > AKAM > > > > $36.33 > > > > $37.94 > > > > -$1.61 > > > > -4.24% > > > > -3.01% > > > > ATVI > > > > $33.8 > > > > $30.9 > > > > $2.90 > > > > 9.39% > > > > 10.62% > > > > YHOO > > > > $26.4 > > > > $25.26 > > > > $1.14 > > > > 4.51% > > > > 5.74% > > >
