since the document says deDateTime considers US holidays and can tell you the expected number of trading days in a month, I assume it calculates these values
(probably similarly to your own solution). I never verified this. Joseph Biran ____________________________________________ _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Herman Sent: Sunday, May 06, 2007 9:52 PM To: J. Biran Subject: Re: [amibroker] AFL Challenging: find yesterday's system data Brian, what i couldn't determine from the DLL doc is whether it uses the system's date/time to determine trading days or data's DateTime stamp. Since i need to calculate this independently from data I am not sure if it will work. I need to play around a bit... many thanks for the idea. herman Monday, May 7, 2007, 12:22:28 PM, you wrote: > Herman, not directly, but maybe from knowing number of trade days passed this month (deGetTradeDayOfMonth()) relatively to total trading days in current month (deTradeDaysInMonth ()), and knowing that today (deFlagDayOfWeek(x))is not a Saturday or Sunday, you can deduct that last trading day was one less than today. Joseph Biran ____________________________________________ _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Herman Sent: Sunday, May 06, 2007 5:03 PM To: J. Biran Subject: Re: [amibroker] AFL Challenging: find yesterday's system data Thank you Brian, i downloaded the DDL/Doc but see nothing in the doc that allows/helps me to find the SysDateNum for yesterday. Nice DLL nevertheless... herman Monday, May 7, 2007, 7:38:45 AM, you wrote: > would any of the deDateTime Plugin help? (I thought all the leap year issues have been resolved there) Joseph Biran ____________________________________________ _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Herman Sent: Sunday, May 06, 2007 2:52 PM To: AmiBroker Subject: [amibroker] AFL Challenging: find yesterday's system data since there has been some talk about solving riddles using AFL one of you gurus might be in the mood to look at my problem: In my AT system I need to know the datenum for the previous trading day (Mon-Fri OK) using my system datetime as reference, i.e i should get that datenum even if I have no data for that day. TIA,herman. I got this far: // Leap year: // 1. Every Year divisible by 4 is a leap Year. // 2. But every Year divisible by 100 is NOT a leap Year // 3. Unless the Year is also divisible by 400, then it is still a leap Year. SysDateNum = Now(3); SysYear = int(SysDateNum/10000)+1900; LeapYear = ( SysYear%4 == 0 AND SysYear%100 != 0 ) OR SysYear%400 == 0; SysMonth = int(SysDateNum/100)%100; if( LeapYear ) DaysInMonth = "31,29,31,30,31,30,31,31,30,31,30,31"; else DaysInMonth = "31,28,31,30,31,30,31,31,30,31,30,31"; Title = "\n"+WriteIf(LeapYear,"LeapYear","NOT a LeapYear")+ ", "+ NumToStr(SysYear,1.0,False)+"\n"+ "#Days in Month: "+DaysInMonth+"\n"+ " Month Number: "+NumToStr(SysMonth,1.0,False); _
