[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

Thanks for your explanation Daniel and for writing/sharing this complex DLL. I believe that date and time arithmetic functions are on the to-do list for AmiBroker. When they appear most our problems will be solved.


With regards to holidays, there is nothing more flexible/accurate then an external list... after all, our birthdays may fall on different dates! 


I fully agree that depending on data time-stamps and assumed-perfect Backfills is too risky. Not too mention the problems before the market's opens, when some some stocks are trading and others are not, bars may be either missing or padded, ref() will give different results, etc. Trading portfolios this can become quite a mess and my struggles are not over yet.


best regards,

herman




Tuesday, May 8, 2007, 9:51:49 AM, you wrote:


> Just wanted to chime in as I wrote the deDateTime plugin (back in 

> 2001/2002!).  I believe I used a static list of US holidays, stored 

> directly as date values in the DLL, as the functions that calculated 

> holidays on the fly were simply too slow.  If memory serves me correct, 

> I had dates stored from 1930 out to 2005, so you may get incorrect 

> values for any dates after Jan 1, 2006.


> I have contemplated releasing a new version of deDateTime, as I added 

> many functions to the DLL that were never released.  I need to dig up 

> the source code as it has been 4 or 5 years since I last looked at it.  

> My schedule these days is a lot tighter, so I can't promise any updates, 

> but I will look into it.


> All functions in the DLL use real date calculations, and pay no regard 

> to bar intervals.  At the time I did extensive intraday trading and 

> there was no facility in AB to do this type of work.  A lot has changed 

> since then, although in my humble opinion, date math, although slower, 

> will always be more accurate than simply referencing previous bar values...


> Daniel

> (the de in deDateTime)  


> J. Biran wrote:


>> 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:* amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 

>> *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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 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: 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

>  

> Yahoo! Groups Links


> <*> To visit your group on the web, go to:

>     http://groups.yahoo.com/group/amibroker/


> <*> Your email settings:

>     Individual Email | Traditional


> <*> To change settings online go to:

>     http://groups.yahoo.com/group/amibroker/join

>     (Yahoo! ID required)


> <*> To change settings via email:

>     mailto:amibroker-digest@xxxxxxxxxxxxxxx 

>     mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx


> <*> 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/

>  

__._,_.___

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

__,_._,___