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

Re: [amibroker] trading days in a week



PureBytes Links

Trading Reference Links

X=DayOfWeek()>Ref(DayOfWeek(),1);
// Plot(X,"",2,2);
Tradingbars=1+Ref(BarsSince(X),-1);
Plot(Tradingbars,"",4,1);
Plot(X*Tradingbars,"",5,2);

Here is a code snippet supplied by Dimitri.....trading days in a week
 
Anthony
 
 
-------Original Message-------
 
From: amibroker@xxxxxxxxxxxxxxx
Date: Wednesday, April 23, 2003 05:31:07
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] trading days in a week
 
Hi,
 
So far the following code works to calc number of trading days in a week
except the first week and the last week of the ticker. I do not understand
why tday still return 5 even though last week only have 2 trading days
(since the week is not over yet) ? Any help is much appreciated.
dw=DayOfWeek();
firsttday = IIf(Cum(1)==1,1,dw < Ref( dw, -1 ));
tday = ValueWhen( firsttday, 1+ BarsSince(Ref(firsttday,-1)),0); 
Many thanks
KK 
 
Yahoo! Groups Sponsor
 
 
 
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 
 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
 
 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/pDi3hB/OC5FAA/AG3JAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/