| 
 PureBytes Links 
Trading Reference Links 
 | 
That also works, Peter.
I just increased jd by 1 so that jd%7 == DOW instead of the conventional (jd +1)%7 == DOW.
Bob 
-----Original Message-----
From: bluesinvestor [mailto:investor@xxxxxxxxxxxxx]
Sent: Wednesday, April 30, 2003 12:21 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: FW: [amibroker] Calendar Dates vs Trading Dates a la 4.34 BETA
Sending again ...
-----Original Message-----
From: bluesinvestor [mailto:investor@xxxxxxxxxxxxx] 
Sent: Wednesday, April 30, 2003 2:14 PM
To: 'amibroker@xxxxxxxxxxxxxxx'
Subject: RE: [amibroker] Calendar Dates vs Trading Dates a la 4.34 BETA
Bob,
Try this:
function Greg2Jul( d, m, y )
{
	/*var y = parseFloat(cd2jdform.yearf.value)
   var m = parseFloat(cd2jdform.monthf.value)
   var d = parseFloat(cd2jdform.dayf.value)
   var uh = parseFloat(cd2jdform.uthf.value)
   var um = parseFloat(cd2jdform.utmf.value)
   var us = parseFloat(cd2jdform.utsf.value)*/
	uh=12;
	um=0;
	us=0;
   extra = 100.0*y + m - 190002.5;
   rjd = 367.0*y;
   //rjd -= floor(7.0*(y+floor((m+9.0)/12.0))/4.0);
	rjd = rjd - floor(7.0*(y+floor((m+9.0)/12.0))/4.0);
   //rjd += floor(275.0*m/9.0);
	rjd = rjd + floor(275.0*m/9.0);
   //rjd += d;
	rjd = rjd + d;
   //rjd += (uh + (um + us/60.0)/60.)/24.0;
	rjd = rjd + (uh + (um + us/60.0)/60.)/24.0;
   //rjd += 1721013.5;
	rjd = rjd + 1721013.5;
   //rjd -= 0.5*extra/abs(extra);
	rjd = rjd - 0.5*extra/abs(extra);
   //rjd += 0.5;*/
	rjd = rjd + 0.5;
	return rjd;
}
Filter=C>0;
AddColumn(Greg2Jul(Day(),Month(),Year()),"Javascript");
AddColumn(Greg2Jul(Day(),Month(),Year())%7+1,"Day");
Regards,
Peter
PS It seems the shorthand += and -= do not work in Amibroker (yet?)
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 
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/AG3JAA/GHeqlB/TM
---------------------------------------------------------------------~->
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 
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
 |