PureBytes Links
Trading Reference Links
|
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 amibroker@xxxxxxxxxxxxxxx, "areehoi" <areehoi@xxx> 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%
>
------------------------------------
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/
|