[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: [amibroker] Calendar Dates vs Trading Dates a la 4.34 BETA



PureBytes Links

Trading Reference Links

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?)




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/GwtQXA/XP.FAA/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/