PureBytes Links
Trading Reference Links
|
Russel,
There are two ways to get the data into AB. Both will require you to write an
external program in Basic, C, or Delphi to pre-process the data before importing
into AB.
The first mehtod is that of putting the new data into the OI field. To put 1 data
item into the OI field, you would multiply that item by whatever is needed to get
ride of the decimals (since the OI field only stores integer values). So if the EY
was 5.98% it could be stored in OI as 598 and then in your AFL code you could access
the EY value in AB with this code: oiEY = OI/100;
But since you want both EY and DY, you would need to "pack" the two items into the
one OI slot by shifting one of the values by 1000 during the packing process and
reversing the shift when using it in AB. Also packing requires that ceiling values
be put on the items to be packed so they do not overlap each other when packed. In
practice that means one could pack two 3 digit items in the OI (or a 2 digit and a 4
digit item). For example:
Packing code (in AFL for understanding, but will need to be translated into Basic or
C or Delphi to create the external pre-processing program that will do the packing.)
DY = ...whatever....
EY = ...whatever...
shiftedDY = DY*100;
shiftedDY = iif(shiftedDY > 999,999,shiftedDY);
shiftedEY = EY*100;
shiftedEY = iif(shiftedEY > 999,999,shiftedEY);
packedOI = DY*1000 + EY*1;
If you do not want to limit the DY and EY to a 9.99% ceiling, you can not use the OI
packing approach.
The alternative is to use create a "secondary" ticker for every ticker currently in
your database and put the DY and EY values into these "secondary" tickers. This
avoids the problems with packing and unpacking and artifical ceilings on values.
You will settle need to write an external program to place the values in a datafile
that will get imported into AB to create the secondary ticker. It could do something
like this. Again I will use AFL code to get the idea across, but it will need to be
translated into Basic or C or Delphi.
Open = EY;
High = DY;
Low = something else you might want to use in testing
Close = something else you might want to use in testing
Volume = something else you might want to use in testing
OI = something else you might want to use in testing
If the EY and DY data is for IBM, then give the new ticker the name "IBM_2". After
importing this secondary ticker into AB, you can get its values by just using the
following call:
EY = Foreign( Name() + "_2", "Open");
DY = Foreign( Name() + "_2", "High");
The secondary ticker approach is simplier to set up and use and it has more capacity
(up to 6 data items without packing), but there is a small, but noticable speed
penalty since AB has to line up the dates of the secondary ticker with the primary
one before returning the Foreign values for each date.
b
--- russel762003 <RWebber@xxxxxxxxx> wrote:
> Hi,
>
> Does anyone know whether it is possible to import dividend yields and
> earnings yields into Amibroker? And whether these values can then be
> used in AFL?
>
> Thanks,
>
> Russel
>
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|