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

[amibroker] Re: When every day is Saturday...



PureBytes Links

Trading Reference Links

Herman,
you may know if a day is added to the last update, but you will never 
know if it was a trading day [without EOD]!!
Try my code and set your PC clock to Monday.
The title will be "Today is MON" [correct] but nobody knows if it is 
a trading day or a holiday.
An easy way to see if a stock is updated :
Select ^NDX and scan with

L1=LastValue(DateNum());
AddToComposite(L1,"~LD","v");
Buy=0;

[I selected L1 as Lastvalue in order to be the same for all bars, do 
not forget that a non-updated stock has holes...and can not "see" all 
^NDX dates...]

Then, for the n=1 last bar, explore all stocks with

L1=LastValue(DateNum());
LL1=Foreign("~LD","V");
Filter=L1!=LL1;
AddColumn(DateNum(),"Last update",1.0);

It is useful also for non-updated composites [I scan many composite 
formulas everyday and, sometimes, I forget to select a _multi.afl... ]
BTW, Database purify tool is now offering all these info automatically
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen" 
<psytek@xxxx> wrote:
> Thanks DT,
> 
> Yes, I understand Now() however i am trying to make an EOD system 
foolproof
> by showing the actual day/date for today and by displaying the last 
day/date
> for the last data bar in the database. Ideally I would like to give 
a
> message when there has been an additional trading day since the 
last update
> of the database. It is not really a critical need but it is fun to 
add
> little features that are usefull for others, less AB-literate, who 
use my
> computer. You point out:
> 
> d. Now(3)-LastValue(DateNum()) for Saturdays will be equal to 1, for
> Sundays will be equal to 2 and for the regular trading days will be
> equal to 1 or 0 [if you hit apply before 24:00 of a trading day will
> be equal to 0, at 00:01 will be 1]
> 
> So, we can conclude that Now(3)-LastValue(DateNum()) is equal to 
zero for
> days that the database is uptodate and >0 when the database needs
> updating... ? Ignoring the Saturday and Sunday, well, actually QP 
produces
> some files on those and other non-trading days as well...so this 
equation
> might not be so bad for detecting an out-of-date database.
> 
> Thanks for the input, I'll try that!
> herman.
> 
> -----Original Message-----
> From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...]
> Sent: Sunday, February 08, 2004 3:21 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: When every day is Saturday...
> 
> 
> Herman,
> Note here that, since Now() Returns current date,
> a. For me [European date] it is a Sunday morning and I read 1040208.
> b. It has nothing to do with trading bars.
> c. Now() IS NOT A UNIVERSAL FUNCTION, some hours od the day Yuki 
will
> read 1040209 and I will still read 1040208.
> d. Now(3)-LastValue(DateNum()) for Saturdays will be equal to 1, for
> Sundays will be equal to 2 and for the regular trading days will be
> equal to 1 or 0 [if you hit apply before 24:00 of a trading day will
> be equal to 0, at 00:01 will be 1]
> Dimitris Tsokakis
> PS. Nice title !!
> --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
> <psytek@xxxx> wrote:
> > Hello,
> >
> > I would like to show the names of days for today and the last data
> bar on
> > some of my charts. Can somebody help me complete code for Today's
> Weekday?
> >
> >   function DayString( D )
> >      {
> >      DayNames
> = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday";
> >      return    StrExtract(DayNames, D);
> >      }
> >
> >   TodaysWeekDay = DayString(Now(3)-LastValue(DateNum())); // <<<<
> WRONG -
> > HELP NEEDED!!!
> >
> >   LastDataWeekDay =
> > DayString(LastValue(ValueWhen(BarIndex()==(BarCount-1),DayOfWeek
> ())));
> >   LastDataDate = LastValue(DateTime());
> >
> >   Title =    "Today's Date: "+TodaysWeekday+" "+Now(1)+
> >         "\nLast Data: "+LastDataWeekDay+"
> > "+NumToStr(LastDataDate,formatDateTime);
> >
> > many thank!
> >
> > herman
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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
> Yahoo! Groups Links



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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

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