PureBytes Links
Trading Reference Links
|
Hi:
Amibroker is a very flexible program so there may be
another way to do arrays of fundamental data into the
database, but here is one I know works -- Store the
fundamental data in a "secondary" ticker.
For example if you want to access the Dividend and EPS data
for XYZ stock, import the Dividend and EPS data into the
Open and Close fields for a ticker called "XYZ_2".
Once the 2ndary ticker with the EPS and Dividend data has
been imported into your AB database, you access the data
with the following a single line of AFL code for each item
of fundamental data:
dividend = Foreign(Name() + "_2","Open");
eps = Foreign(Name() + "_2","Close");
// Name() gets the current ticker, eg XYZ
// + "_2" converts XYZ into "XYZ_2"
// Foreign() finds XYZ_2 in the database and gets the data
Some Tips:
1. If one is planning to run the back testing on the entire
database, consider putting the 2ndary tickers into an AB
"group" or AB "market". Then use the backtesting filter to
exclude that group or market. During the importing of the
2ndary data the newly created tickers can be automatically
added to a particular group or market.
2. Most the work is getting the data ready to import. For a
few stocks, Excel can be used. The name of the "2ndary"
ticker needs to be put in a column, also there needs to be
a column for dates.
3. If possible, use Excel to convert any numbers into
ratios before importing into AB. This will save work if the
stock ever does a split. For example, instead of storing
the raw EPS number in dollars and cents, store it as a
percentage.
4. Which AB fields are best for storing the data? Open,
High, Low, Close will hold decimal values and have 5
significant digits before rounding affects precision.
Volume and OI fields are integer so decimals imported into
V and OI will loose the decimal portion, but the integer
fields have at least 9 significant digits of precision (if
my memory is correct.) If one needs more than 5 significant
digits with decimals, one can "pack" the data using Excel
before storing in the V or OI field and then "unpack" it
within AB as needed.
For example, if one wanted Divident yield in percentage
with 8 signiticant digits of precision, multiply by 10,000
in Excel (to get all the significant digits out of the
decimal portion). Within AB, just divide by 10,000.
5. Negative numbers sometimes do not get imported correctly
into AB because AB, by default I think, does checks to make
sure the imported data is "reasonable". Since stocks do not
sell for negative numbers, negatives imported into the
O,H,L,C fields will end up as zero. However, there may be a
way to turn this checking off. If not, one can always do a
"shift" when "packing" the numbers in Excel. If the lowest
possible negative number is -999, then just add 1,000 to
that column in Excel and then subtract 1,000 when unpacking
in AB. Shift works.
6. If you have more than 6 items of fundamental data, you
can create another "2ndary" ticker, such as "XYZ_3". Or if
the data items have only 2 significant digits, you could
"pack" 2 items of fundamental data into a single AB field.
Within AB, one would use the "int" and "frac" calls to
split the number (assuming one item is in the decimal
portion and the other number is in the integer portion).
7. Excel will be fine for preparing the data for a few
stocks, but if you have a lot of stocks (or if you get into
a lot of "packing" and "shifting" of data values, you might
want to have a special program written in Basic or Delphi
to save time and avoid manual errors.
Good luck.
b
--- duke.jones <Duke.Jones@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Tomasz,
>
> Please excuse my ignorance in advance but can these
> fields store arrays? For example can I store a series of
> values tied to a specific symbol like a quantitative
> score that I import into AB? I produce a fundamental and
> quantitative score for the stocks of the major indices
> and it would be great if I could plot them along with the
> symbol. For example I would like to plot my values just
> like you can plot the QRS or EPS Rank values from Quotes
> Plus per symbol that can be done now.
>
> Thanks,
>
> Duke Jones, CMT
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
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:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|