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

RE: [amibroker] AFL Challenging: find yesterday's system data



PureBytes Links

Trading Reference Links

would any of the deDateTime Plugin help?
(I thought all the leap year issues have been resolved there)


Joseph Biran
____________________________________________


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 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);

 

__._,_.___

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___