PureBytes Links
Trading Reference Links
|
Michael,
the code below is close for one Ticker.
The "-DD" file was created as i indicated earlier.
Specifically take your dividend file into excel and develop a datenum
field in open interest.
in excel set up columns for year month day and write
FORMULAS FROM RANGE H2:M2 etc
h2 is open interest
H2. =M2
I2. =YEAR(B2)
J2. =I2-1900
K2. =TEXT(MONTH(B2),"00")
L2. =TEXT(DAY(B2),"00")
M2. =CONCATENATE(J2,K2,L2)
Then paste special values to open interest.
Then import it into AB.
I played around with adjusting the data to agree with the latest
price, but then i thought why bother all the others are different
anyway.
The next steps are
1. to get the exploration into a <SYM>"-DA" file preferably
automatically
2. to generalize the code to step through the db for all -Divd
3. do the excel stuff within ab before step 2.
4. allow for new prices and dividends (or not)
can you take some of that on?
here's the code for the ANZ example exploration
/*part of dividend adjustment - determine cumulative dividend*/
x=StrLeft(Name(),3);
select=StrLeft(x,3)=="ANZ" AND StrLen(Name())==3;
Filter= select;
divfile=x+"-DD";
fd=Foreign(divfile,"i");
div=100*Foreign(divfile,"H");
ex=IIf((fd-DateNum()==0)
AND (1==Foreign(divfile,"o"))
,1,0);
div=div*ex;//(ex AND 1==Foreign(divfile,"o"));
divtot=Cum(div);
divtot=IIf(IsNull(divtot),0,divtot);
divadj=divtot/100;
AdjC=C+divadj;
Adjo=O+divadj;
adjh=H+divadj;
adjl=L+divadj;
AdjC=C+divadj;
AddColumn(adjO,"Adj. O" );
AddColumn(adjh,"Adj. H" );
AddColumn(adjL,"Adj. L" );
AddColumn(adjc,"Adj. C" );
AddColumn(C,"Close" ); // just for comparison not required
//following fields used in development and not required in use
//AddColumn(ex,"ex",2);
//AddColumn(div,"div");
//AddColumn(divtot,"divtot");
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/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/
|