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

RE: [amibroker] Date



PureBytes Links

Trading Reference Links

If you have specific odd days such as Holidays (or full moon days), and there's not too many of them try this code which identifies Holidays as listed, dayofweek, end of week and options expiration days:

 

//Holidays from 3/25/2005 (Good Friday) until 12/26/2006 (XMas Day) from http://www.nasdaq.com/about/schedule.stm.

//Actually these are the TRADING Day BEFORE the Holiday.

    _N(Holidates = "1050324,1050527,1050701,1050902,1051123,1051223");

    _N(Holidays = "Good Friday,Memorial Day,4th of July,Labor Day,Thanksgiving,Christmas");

    _N(tempDay = NumToStr(DateNum(),1.0));

    _N(Holiday = "");

 

//Report upcoming Holiday AND note for Trend change.

    for( i = 0; (CheckHoliday = StrExtract(Holidates,i)) != ""; i++ ) //Search for Holidays until the list of Holidays is exhausted

    {

        if(StrToNum(tempDay) == StrToNum(CheckHoliday))

        {

            Holiday = ", Tomorrow is " + StrExtract(Holidays,i);

        }

    }

 

//Get Day of Week and print it + any found Holiday

    i = DayOfWeek();

    "It's " + WriteIf(i == 1,"Monday",WriteIf(i == 2,"Tuesday",

        WriteIf(i == 3,"Wednesday",WriteIf(i == 4,"Thursday","Friday")))) + Holiday;

 

//Find last trading day of the week (EOW = end of week). Make special note if it's an Options Expiration day.

    EOW = IIf(((DayOfWeek()<5 AND DayOfWeek()>2 AND Ref(DayOfWeek(),1) < 2) OR DayOfWeek()==5) OR (DayOfWeek() == 4 AND StrLeft(Holiday,8) == "Tomorrow" AND BarIndex() == LastValue( BarIndex())),True,False);

    expiry = IIf(EOW AND Day() > 14  AND Day() < 22,True,False);

    //The above code looks into the future, but only to determine last day of week.

    //This data is only used for Interpretation window. No other formulas look into future. This is for INFO ONLY.

 

--

Terry

| -----Original Message-----

| From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On

| Behalf Of Amon Ra

| Sent: Sunday, September 04, 2005 21:48

| To: amibroker@xxxxxxxxxxxxxxx

| Subject: Re: [amibroker] Date

|

| Thanks all, but I don't need to select Wednesdays. I

| need that code to verify some trading systems. It's

| also good to select full moon days (28 days)!

|

| How can I do this?

|

|

|

| --- Graham <kavemanperth@xxxxxxxxx> wrote:

 

 

Terry Hulseberg
HULSEBERG CONSULTING
http://www.hulseberg.com
+7.720.294.9665 Fax
+1.303.523.0050 Worldwide
Mobile (GSM)

 



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 other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS